【发布时间】:2017-12-06 20:16:58
【问题描述】:
我有基于https://github.com/coryhouse/react-slingshot 的反应应用程序。 我有网址:/about 如果我通过本地主机上的开发模式或生产直接访问此 url,它工作正常。 但是在通过 nginx 的 EC2 实例中我得到了错误:
404 未找到
nginx/1.10.3 (Ubuntu)
这是我的 nginx 配置文件:
server {
listen 80;
server_name example.com;
return 301 https://$server_name$request_uri;
}
server {
listen 443 ssl;
root /home/ubuntu/www/example;
index index.html index.htm;
add_header Strict-Transport-Security "max-age=31536000";
ssl_certificate /etc/letsencrypt/live/example.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/example.com/privkey.pem;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_prefer_server_ciphers on;
ssl_ciphers 'EECDH+AESGCM:EDH+AESGCM:AES256+EECDH:AES256+EDH:AES256+ECDHE';
# Make site accessible from http://localhost/
server_name example.com;
location / {
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
try_files $uri $uri/ =404;
# Uncomment to enable naxsi on this location
# include /etc/nginx/naxsi.rules
}
}
如何正确配置它?谢谢!
【问题讨论】:
标签: reactjs nginx amazon-ec2 react-router