我試圖讓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。 –