Nginx default website path in subdirectory rather than / (root)

F

FreeMind

Guest
I want to configure my site so it runs in a subdirectory rather than mydomain/. I mean instead of going to mysite.com/ and seeing the website, I want it to be seen from mydomain/myproject. I am using uwsgi to talk to a flask website and here is my /etc/nginx/sites-available/myproject config file.

server {
server_name mydomain www.mydomain;

location / {
include uwsgi_params;
uwsgi_pass unix:/root/Desktop/myproject/myproject.sock;
}

listen 443 ssl; # managed by Certbot
ssl_certificate /etc/letsencrypt/live/mydomain/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/mydomain/privkey.pem; # managed by Certbot
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot


}
server {
if ($host = www.mydomain) {
return 301 https://$host$request_uri;
} # managed by Certbot


if ($host = mydomain) {
return 301 https://$host$request_uri;
} # managed by Certbot


listen 80;
server_name mydomain www.mydomain;
return 404; # managed by Certbot

}



I tried to change the code from location / to location /myproject or location = /myproject but it gave me not found! Thanks

Continue reading...
 
Top