账号密码登录
微信安全登录
微信扫描二维码登录

登录后绑定QQ、微信即可实现信息互通

手机验证码登录
找回密码返回
邮箱找回 手机找回
注册账号返回
其他登录方式
分享
  • 收藏
    X
    nginx部署多个vue项目
    • 2019-10-23 00:00
    • 11
    25
    0

    nginx配置如下
    nginx.conf

    user www-data;
    worker_processes auto;
    pid /run/nginx.pid;
    
    events {
            worker_connections 768;
            # multi_accept on;
    }
    
    http {
            sendfile on;
            keepalive_timeout 65;
            types_hash_max_size 2048;
    
            include /etc/nginx/mime.types;
            default_type application/octet-stream;
    
            ssl_protocols TLSv1 TLSv1.1 TLSv1.2; # Dropping SSLv3, ref: POODLE
            ssl_prefer_server_ciphers on;
    
            access_log /var/log/nginx/access.log;
            error_log /var/log/nginx/error.log;
    
            gzip on;
            gzip_disable "msie6";
    
            access_log /var/log/nginx/access.log;
            error_log /var/log/nginx/error.log;
            
            gzip on;
            gzip_disable "msie6";
    
            include /etc/nginx/conf.d/*.conf;
            include /etc/nginx/sites-enabled/*;
    }
    

    sites-enabled > default

    
    server {
            listen 80 default_server;
            listen [::]:80 default_server;
    
            # Add index.php to the list if you are using PHP
            index index.html index.htm index.nginx-debian.html;
    
            server_name _;
    
            location / {
                    # First attempt to serve request as file, then
                    # as directory, then fall back to displaying a 404.
                    proxy_pass http://127.0.0.1:3000;
            }
            location /admin/ {
                root /root/cms-admin/dist;
                try_files $uri $uri/ /index.html;
                index index.html index.htm;
            }
            location ~ .*\.(js|css|png|jpg|gif|swf|ico|pdf|mov|mp3|wav|json|woff2)$ {
                proxy_pass http://127.0.0.1:3000;
            }
    
            location /api/ {
                proxy_pass  http://127.0.0.1:3002/api/;
            }
    
    }
    

    3000端口跑了一个ssr项目,可以正常访问
    访问xxx/admin返回500,请问是哪里出了问题
    可以确定/root/cms-admin/dist下存在index.html文件

    0
    打赏
    收藏
    点击回答
    您的回答被采纳后将获得:提问者悬赏的 11 元积分
        全部回答
    • 0
    更多回答
    扫一扫访问手机版
    • 回到顶部
    • 回到顶部