CS296N Web Development 2: ASP.NET                                              

Troubleshooting Deployment to Linux

Topics by week
1. Intro to course and Identity
6. Midterm, Load Testing and Performance
2. Authentication and Authorization 7. Creating a Web Service
3. Claims and Third Party Authentication
8. Consuming a Web Service, Async / Await
4. Web Security
9. Docker Containers
5. Publishing to a production server 10.  Microservices

Forwarding requests to Kestral from Apache

For a single web site

Apache Configuration files are in the /etc/httpd/conf.d/ directory. Any files with the .conf extension are processed in alphabetical order in addition to the module configuration files in the /etc/httpd/conf.modules.d/ directory.
  1. Create a configuration file for your app.
    Note that the example conf file below could be improved by using variables for the request type and log file names, and by specifying a domain.
    myapp.conf:
    <VirtualHost *:*>
      RequestHeader set X-Forwarded-Proto "http"
    </VirtualHost>
    
    <VirtualHost *:80>
      ProxyPreserveHost On
      ProxyPass / http://127.0.0.1:5000/
      ProxyPassReverse / http://127.0.0.1:5000/
      ErrorLog /var/log/apache2/myapp-error.log
      CustomLog /var/log/apache2/myapp-access.log common
    </VirtualHost>
                        
    • ProxyPreserveHost - Instructs Apache mod_proxy, when acting as a reverse proxy, to preserve the original host header from the client browser when constructing the proxied request to send to the backend server.
    • ProxyPass - Specifies the mapping of incoming requests to a backend server.
    • ProxyPassReverse - Ensures that Location headers generated from the backend are modified to point to the reverse proxy, instead of back to itself.

  2. Restart Apache:
    sudo systemctl restart httpd
    sudo systemctl enable httpd
                    

Notes:

Find the Apache Web Roots

On CentOs:
 
# grep -i 'DocumentRoot' /etc/httpd/conf/httpd.conf
            

References