I have set up Nginx on my server to serve static files for a front-end application. The root URL (http://xxx.85.127.14/) correctly serves files, but when I try to access http://xxx.85.127.14/admin I get an ERR_EMPTY_RESPONSE error in the browser.
However, when I test locally it works:
curl -I http://localhost/admin
Server & Environment Details:
OS: Ubuntu 20.04
Web Server: Nginx
Frontend Framework: React/Vue (if applicable)
Deployment Directory:
/root/deployment/user/dist(for/) user/root/deployment/admin/dist(for/admin)
Nginx Configuration (/etc/nginx/sites-available/default)
server {
listen 80 default_server;
listen [::]:80 default_server;
server_name xxx.85.127.14;
location / {
root /root/deployment/user/dist;
index index.html;
try_files $uri /index.html;
}
location /admin {
root /root/deployment/admin/dist;
index index.html;
try_files $uri /index.html;
}
location /api/ {
proxy_pass http://localhost:5000/;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}
info)? This may be as simple as a rights problem…error_log /tmp/nginx_error.log info; access_log /tmp/nginx_access.log info;at the start of your nginx config file, restart your nginx, try to access first your/then your/adminand then look into the aforementionned.logfiles for something indicating it cannot accessadmin; or if nothing looks strange, compare the parts corresponding to an access to/and an access to/admin, to see at which step/adminreturned prematurely while/continued until it served the page.