jackieli123723 / jackieli123723.github.io

✅lilidong 个人博客
9 stars 0 forks source link

nginx代理spa网页403解决方案 #38

Open jackieli123723 opened 6 years ago

jackieli123723 commented 6 years ago

nginx 权限(默认为nginx会导致403 错误)

user nobody;

user root

[root@172 nginx]# cat nginx.conf
# For more information on configuration, see:
#   * Official English Documentation: http://nginx.org/en/docs/
#   * Official Russian Documentation: http://nginx.org/ru/docs/

user root;
worker_processes auto;
error_log /var/log/nginx/error.log;
pid /run/nginx.pid;

# Load dynamic modules. See /usr/share/nginx/README.dynamic.
include /usr/share/nginx/modules/*.conf;

events {
    worker_connections 1024;
}

Nginx.conf开头不能默认为nginx,修改为nobody 或者root切记!!!

最简单配置

root方式默认80端口指定域名才可以

内网访问修改host服务器ip指向nginx.conf里面的server域名

http{
    //添加静态压缩等配置
     server {
        listen       80;
        server_name rms.ops.dragonest.com;

        location / {

            #静态资源指向
            #root   html;
            root   /root/docker/rms-web/dist;
            index  index.html index.htm;
            error_page 404 /index.html;

        }

    }   

}