我试图让http://example.com服务于/home/ubuntu/mysitedir/home.html的http://example.com/home.html。nginx根指令导致404
我有以下conf文件,它将所有内容成功重定向到https和代理到uwsgi。 http-> https重定向工作正常,并且uwsgi代理可以工作,但http(s)://example.com/,http(s)://example.com/home.html,http(s):// example.com/index.html和http(s)://example.com/index.htm都是404
任何指针,我可以尝试什么?
这里是我的conf文件:
server {
listen 80;
server_name example.com;
return 301 https://$server_name$request_uri;
root /home/ubuntu/mysitedir/;
index home.html;
}
server {
listen 443 ssl;
server_name example.com;
ssl_certificate /etc/nginx/ssl/example_combined.crt;
ssl_certificate_key /etc/nginx/ssl/www.example.com.key;
root /home/ubuntu/mysitedir/;
index home.html;
location /images/ads {
alias /home/ubuntu/mysitedir/images/ads/;
}
location /images {
alias /home/ubuntu/mysitedir/images/;
}
location /static {
alias /home/ubuntu/mysitedir/static/;
}
location/{
alias /home/ubuntu/mysitedir/;
include uwsgi_params;
uwsgi_pass unix:/tmp/mysitedir.sock;
}
}
感谢。
感谢miah。我试过了,无论有没有root指令都无济于事。此外,如果我将index.htm和index.html放在/ home/ubuntu/mysitedir /和/ usr/share/nginx/html /,http(s)://example.com/中,http(s):/ /example.com/home.html,http(s)://example.com/index.html和htt(s)p://example.com/index.htm都是404 –
@stubblejumper刚更新了什么我认为会起作用。 – miah
它很好用。感谢你的帮助miah。 –