【发布时间】:2021-06-02 13:15:06
【问题描述】:
我已经为 nginx 配置了 MacOS,并在其上部署了我的 react js 应用程序,它已成功部署并运行,但是当我重新刷新任何页面时,它显示 404 not found。
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/*;
}
【问题讨论】:
-
缺少一些细节。你能告诉我们nginx配置吗
-
这应该会有所帮助 - stackoverflow.com/questions/43555282/…
-
@Shyam 我也试过,但没用。
-
@jibeeeeee 我在问题描述中添加了配置。
-
配置文件看起来正常。 刷新时出现404是什么意思?那么所有页面都可以第一次访问?