I have two applications. One is a Django app and the files for this is located at /home/founders/founders/back
The site is running and you can see it on founderslooking.com
I have another Vue site that forms part of the founderslooking.com site and the files are located at /home/founders/founders/dist
I want the Vue app to run at the location founderslooking.com/app
This is how I set it up. First here is the conf file for the Django site running at founderslooking.com
upstream founders_app_server {
server unix:/home/founders/founders/run/gunicorn.sock fail_timeout=0;
}
server {
listen 80;
server_name founderslooking.com default_server;
client_max_body_size 4G;
location / {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_redirect off;
if (!-f $request_filename) {
proxy_pass http://founders_app_server;
}
# auth_basic "Testing";
# auth_basic_user_file /home/founders/founders/.htpasswd;
}
location /static/ {
autoindex on;
root /home/founders/founders/back;
}
}
and here is my set up for the Vue site I need to make run on founderslooking.com/app:
server {
listen 80;
location /app/ {
alias /home/founders/founders/dist/;
try_files $uri $uri/ /index.html;
}
}
the conf files are located in sites-available and are called founders.conf and app.conf and I have sim links to those files in sites-enabled.
If I go to founderslooking.com/app/user/1 which is the currently logged in user then I get a Not Found page.
How am I then supposed to host a second site (static) on the same domain? Why is Nginx not getting the index.html file in /home/founders/founders/dist if I go to founderslooking.com/app? Isn't that what the alias /home/founders/founders/dist do?
server
block. See How nginx processes a request.location /app/
block, the correct URL for your index file is/app/index.html
, which should be at the end of thetry_files
statement instead of/index.html