我已经为nginx配置了MacOS,并在上面部署了我的react js应用程序,它成功地部署并运行了,但当我重读任何页面时,它显示404未找到。
worker_processes 1;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
server {
listen 8080;
server_name localhost;
location / {
root html;
index index.html index.htm;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}
server {
listen 8080 default_server;
server_name TESTAPP;
root /var/www/TESTAPP;
index index.html index.htm;
location / {
root /var/www/TESTAPP/static;
index index.html index.htm;
try_files $uri /index.html$is_args$args =404;
}
}
include servers/*;
}
你能试试下面的方法吗?
这是我用来做水疗的东西。
server {
listen 8080 default_server;
root /var/www/TESTAPP;
index index.html index.htm;
server_name TESTAPP;
location / {
try_files $uri $uri/ =404;
}
}