/etc/nginx/sites-enabled/ www.example.com中不允许使用nginx:[emerg]“server”指令myapp.com:34

nkkqxpd9  于 2023-04-20  发布在  Nginx
关注(0)|答案(1)|浏览(176)

我收到一个无法解决的关于服务器指令的错误:
/etc/nginx/sites-enabled/ www.example.com中不允许使用nginx:[emerg]“server”指令myapp.com:34
请帮帮我

server
{

    server_name admin.buspect-app.com;

    location /
    {
        root /var/www/admin;
        index index.html;
        
        proxy_pass http://127.0.0.1:3000/;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header Host $http_host;
        proxy_set_header X-NginX-Proxy true;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";
        proxy_ssl_server_name on;
    }

    location /backend/
    {
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header HOST $http_host;
        
        proxy_pass http://nestjs;

        

     
        server
        {
            listen 80;
            server_name admin.buspect-app.com;

            location /
            {
                proxy_pass http://localhost:3000;
                proxy_set_header Host $host;
                proxy_set_header X-Real-IP $remote_addr;
            }
        }

        server
        {
            listen 443 ssl; # managed by Certbot
            ssl_certificate /etc/letsencrypt/live/admin.buspect-app.com/fullchain.pem; # managed by Certbot
            ssl_certificate_key /etc/letsencrypt/live/admin.buspect-app.com/privkey.pem; # managed by Certbot
            include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
            ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
            server_name admin.buspect-app.com;

            location /
            {
                proxy_pass http://localhost:3000;
                proxy_set_header Host $host;
                proxy_set_header X-Real-IP $remote_addr;
            }
        }

        #listen 443 ssl; # managed by Certbot
        # ssl_certificate /etc/letsencrypt/live/admin.buspect-app.com/fullchain.pem; # managed by Certbot
        #  ssl_certificate_key /etc/letsencrypt/live/admin.buspect-app.com/privkey.pem; # managed by Certbot
        #   include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
        #    ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
    }

    server
    {
        server_name lynx.buspect-app.com;
        # node api reverse proxy
        location /
        {
            proxy_set_header Upgrade $http_upgrade;
            proxy_set_header Connection "Upgrade";
            proxy_http_version 1.1;
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
            proxy_set_header Host $host;
            proxy_pass http://localhost:4000;
        }

        listen 443 ssl; # managed by Certbot
        ssl_certificate /etc/letsencrypt/live/admin.buspect-app.com/fullchain.pem; # managed by Certbot
        ssl_certificate_key /etc/letsencrypt/live/admin.buspect-app.com/privkey.pem; # managed by Certbot
        include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
        ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot

    }
    server
    {
        server_name root.buspect-app.com;

        location /
        {
            root /var/www/super-admin;
            index index.html;
            
            proxy_pass http://127.0.0.1:3001/;
            proxy_set_header X-Real-IP $remote_addr;
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
            proxy_set_header Host $http_host;
            proxy_set_header X-NginX-Proxy true;
            proxy_http_version 1.1;
            proxy_set_header Upgrade $http_upgrade;
            proxy_set_header Connection "upgrade";
            proxy_ssl_server_name on;
        }

        listen 443 ssl; # managed by Certbot
        ssl_certificate /etc/letsencrypt/live/admin.buspect-app.com/fullchain.pem; # managed by Certbot
        ssl_certificate_key /etc/letsencrypt/live/admin.buspect-app.com/privkey.pem; # managed by Certbot
        include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
        ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot

    }
    server
    {
        listen 80;
        server_name lynx.buspect-app.com;

        if ($host = lynx.buspect-app.com)
        {
            return 301 https://$host$request_uri;
        }

        return 404;
    }

    
    server
    {
        listen 80;
        server_name lynx.buspect-app.com;

        if ($host = lynx.buspect-app.com)
        {
            return 301 https://$host$request_uri;
            } # managed by Certbo
        }
        # managed by Certbot

        return 404; # managed by Certbot
    }

    
    server
    {
        listen 80;
        server_name lynx.buspect-app.com;

        if ($host = lynx.buspect-app.com)
        {
            return 301 https://$host$request_uri;
            } # managed by Certbo
        }
        # managed by Certbot

        return 404; # managed by Certbot
    }
  
}
pengsaosao

pengsaosao1#

你把一个服务器块放在一个服务器块里面,这是非法的,也没有意义。

相关问题