0

I have configured nginx for proxy but nginx cant start with following config:

conf:

server {
    listen 8080;
    server_name localhost localhost.localdomain;

    location / {
        root /var/www/html;
        access_log  /var/log/nginx/access.log;
}

server {
    listen 80;
    location / {
        proxy_http_version 1.1;
        proxy_pass $http_host$request_uri;
        proxy_set_header X-Forwarded-For "";
        proxy_set_header X-Forwarded-Port "";
        proxy_set_header X-Forwarded-Proto "";
    }
}

server {
    resolver localhost ipv6=off;
    listen 443 ssl;
    ssl on;
    ssl_certificate /etc/nginx/certificates/fullchain1.pem;
    ssl_certificate_key /etc/nginx/certificates/privkey1.pem;
        location / {
                proxy_http_version 1.1;
                proxy_pass https://$host$request_uri;
        proxy_set_header      X-Forwarded-Proto $scheme;
        proxy_set_header      User-Agent $http_user_agent;
        proxy_set_header X-co-auth-token $http_x_co_auth_token;
        proxy_set_header X-Request-ID $http_x_fs_request_id;
                proxy_set_header Referer $http_referer;
                proxy_set_header Sec-Fetch-Mode $http_sec_fetch_mode;
                proxy_set_header Cookie $http_cookie;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection $http_connection;
        proxy_set_header Origin $http_origin;
        proxy_set_header Sec-WebSocket-Extensions $http_sec_websocket_extensions;
        proxy_set_header Sec-WebSocket-Key $http_sec_websocket_key;
        proxy_set_header Sec-WebSocket-Version $http_sec_websocket_version;
    }
}

after running nginx -t i have: [emerg] "server" directive is not allowed here in /etc/nginx/nginx.conf:6

and i cant understand where is the problem maybe all config is broken?

Swap24
  • 1

0 Answers0