How to configure multiple servers on the same IP address with Nginx?

VAT refund for a conference ticket in Sweden

How can atoms be electrically neutral when there is a difference in the positions of the charges?

A bug in Excel? Conditional formatting for marking duplicates also highlights unique value

Manipulate scientific format without the "e"

What is a term for a function that when called repeatedly, has the same effect as calling once?

Real life puzzle: Unknown alphabet or shorthand

Does being OVERLY tall affect taekwondo?

I encountered my boss during an on-site interview at another company. Should I bring it up when seeing him next time?

Borrowing Characters

How to lift/raise/repair a segment of concrete slab?

Is divide-by-zero a security vulnerability?

The need of reserving one's ability in job interviews

Six real numbers so that product of any five is the sixth one

Did Amazon pay $0 in taxes last year?

Non-Italian European mafias in USA?

Sometimes a banana is just a banana

Is there a math equivalent to the conditional ternary operator?

Called into a meeting and told we are being made redundant (laid off) and "not to share outside". Can I tell my partner?

Reason why dimensional travelling would be restricted

I can't die. Who am I?

Can we carry rice to Japan?

Alameda and Belisario throwing a fair die.

What am I? I am in theaters and computer programs

Why is s'abonner reflexive?



How to configure multiple servers on the same IP address with Nginx?














0















I'm starting with Nginx.



I installed on my server:




  • 1 Drupal site on www.domaine.com

  • 1 GoAccess site on analytics.omaine.com

  • 1 Netdata site on monitoring.domaine.com


The IP address and domain.com must redirect to www.domain.com



All domain and subdomain dovent redirect to https



On my OVH web host, I created domains domain.com www.domain.com analytics.domain.com monitoring.domain.com pointing to the IP address of my server.



When I enter the IP address of my server in the browser's address bar, it redirects to analytics.domaine.com why ?



How to redirect to www.domain.com ?



Before creating the configuration for analytics.domain.com and monitoring.domain.com it worked.



When I test my configuration :



sudo nginx -t



nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful


sudo nano /etc/nginx/sites-available/www-domaine-com



server {
listen 443 ssl http2;
listen [::]:443 ssl ipv6only=on http2;
server_name www.domaine.com;
root /var/www/www-domaine-com/web;

ssl_certificate /etc/letsencrypt/live/domaine.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/domaine.com/privkey.pem;
include /etc/letsencrypt/options-ssl-nginx.conf;
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem;

add_header Strict-Transport-Security "max-age=15768000; includeSubDomains; preload" always;
add_header X-Content-Type-Options "nosniff" always;
add_header X-XSS-Protection "1; mode=block" always;
add_header X-Frame-Options "SAMEORIGIN" always;
add_header X-Download-Options "noopen" always;
add_header X-Permitted-Cross-Domain-Policies "none" always;
add_header Content-Security-Policy "default-src https: data: wss: 'unsafe-inline' 'unsafe-eval'; base-uri 'self';" always;

gzip on;
gzip_vary on;
gzip_proxied any;
gzip_comp_level 6;
gzip_types text/css text/javascript text/xml text/plain text/x-component application/javascript application/json application/xml application/rss+xml font/truetype font/opentype application/vnd.ms-fontobject image/svg+xml;

expires 1209600s;

location = /favicon.ico {
log_not_found off;
access_log off;
}

location = /robots.txt {
allow all;
log_not_found off;
access_log off;
}

location ~* .(txt|log)$ {
deny all;
}

location ~ ..*/.*.php$ {
return 403;
}

location ~ ^/sites/.*/private/ {
return 403;
}

location ~ ^/sites/[^/]+/files/.*.php$ {
deny all;
}

location ~* ^/.well-known/ {
allow all;
}

location ~ (^|/). {
return 403;
}

location / {
try_files $uri /index.php?$query_string;
}

location @rewrite {
rewrite ^/(.*)$ /index.php?q=$1;
}

location ~ /vendor/.*.php$ {
deny all;
return 404;
}

location ~ '.php$|^/update.php' {
expires off;
fastcgi_split_path_info ^(.+?.php)(|/.*)$;
include fastcgi_params;
fastcgi_param HTTP_PROXY "";
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param QUERY_STRING $query_string;
fastcgi_intercept_errors on;
fastcgi_pass unix:/var/run/php/php7.3-fpm.sock;
}

location ~ ^/sites/.*/files/styles/ {
try_files $uri @rewrite;
}

location ~ ^(/[a-z-]+)?/system/files/ {
try_files $uri /index.php?$query_string;
}

location ~* .(js|css|png|jpg|jpeg|gif|ico|svg)$ {
try_files $uri @rewrite;
expires max;
log_not_found off;
}
}

server {
listen 80;
server_name www.domaine.com domaine.com;
return 301 https://$server_name$request_uri;
}

server {
listen 443;
server_name domaine.com;
return 301 https://www.$server_name$request_uri;
}


sudo nano /etc/nginx/sites-available/analytics-domaine-com



server {
listen 443 ssl http2;
server_name analytics.domaine.com;
root /var/www/analytics-domaine-com/web;
report.html;

auth_basic "Protected";
auth_basic_user_file /var/www/analytics-domaine-com/web/.htpasswd;

ssl_certificate /etc/letsencrypt/live/analytics.domaine.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/analytics.domaine.com/privkey.pem;
include /etc/letsencrypt/options-ssl-nginx.conf;
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem;
}

server {
listen 80;
server_name analytics.domaine.com;
return 301 https://$server_name$request_uri;
}


sudo nano /etc/nginx/sites-available/monitoring-domaine-com



upstream backend {
server 127.0.0.1:19999;
keepalive 64;
}

server {
listen 443 ssl http2;
server_name monitoring.domaine.com;
root /var/www/monitoring-domaine-com/web;

auth_basic "Protected";
auth_basic_user_file /var/www/monitoring-domaine-com/web/.htpasswd;

ssl_certificate /etc/letsencrypt/live/monitoring.domaine.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/monitoring.domaine.com/privkey.pem;
include /etc/letsencrypt/options-ssl-nginx.conf;
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem;

location / {
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-Server $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass http://backend;
proxy_http_version 1.1;
proxy_pass_request_headers on;
proxy_set_header Connection "keep-alive";
proxy_store off;
}
}

server {
listen 80;
server_name monitoring.domaine.com;
return 301 https://$server_name$request_uri;
}








share







New contributor




ML19 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.

























    0















    I'm starting with Nginx.



    I installed on my server:




    • 1 Drupal site on www.domaine.com

    • 1 GoAccess site on analytics.omaine.com

    • 1 Netdata site on monitoring.domaine.com


    The IP address and domain.com must redirect to www.domain.com



    All domain and subdomain dovent redirect to https



    On my OVH web host, I created domains domain.com www.domain.com analytics.domain.com monitoring.domain.com pointing to the IP address of my server.



    When I enter the IP address of my server in the browser's address bar, it redirects to analytics.domaine.com why ?



    How to redirect to www.domain.com ?



    Before creating the configuration for analytics.domain.com and monitoring.domain.com it worked.



    When I test my configuration :



    sudo nginx -t



    nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
    nginx: configuration file /etc/nginx/nginx.conf test is successful


    sudo nano /etc/nginx/sites-available/www-domaine-com



    server {
    listen 443 ssl http2;
    listen [::]:443 ssl ipv6only=on http2;
    server_name www.domaine.com;
    root /var/www/www-domaine-com/web;

    ssl_certificate /etc/letsencrypt/live/domaine.com/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/domaine.com/privkey.pem;
    include /etc/letsencrypt/options-ssl-nginx.conf;
    ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem;

    add_header Strict-Transport-Security "max-age=15768000; includeSubDomains; preload" always;
    add_header X-Content-Type-Options "nosniff" always;
    add_header X-XSS-Protection "1; mode=block" always;
    add_header X-Frame-Options "SAMEORIGIN" always;
    add_header X-Download-Options "noopen" always;
    add_header X-Permitted-Cross-Domain-Policies "none" always;
    add_header Content-Security-Policy "default-src https: data: wss: 'unsafe-inline' 'unsafe-eval'; base-uri 'self';" always;

    gzip on;
    gzip_vary on;
    gzip_proxied any;
    gzip_comp_level 6;
    gzip_types text/css text/javascript text/xml text/plain text/x-component application/javascript application/json application/xml application/rss+xml font/truetype font/opentype application/vnd.ms-fontobject image/svg+xml;

    expires 1209600s;

    location = /favicon.ico {
    log_not_found off;
    access_log off;
    }

    location = /robots.txt {
    allow all;
    log_not_found off;
    access_log off;
    }

    location ~* .(txt|log)$ {
    deny all;
    }

    location ~ ..*/.*.php$ {
    return 403;
    }

    location ~ ^/sites/.*/private/ {
    return 403;
    }

    location ~ ^/sites/[^/]+/files/.*.php$ {
    deny all;
    }

    location ~* ^/.well-known/ {
    allow all;
    }

    location ~ (^|/). {
    return 403;
    }

    location / {
    try_files $uri /index.php?$query_string;
    }

    location @rewrite {
    rewrite ^/(.*)$ /index.php?q=$1;
    }

    location ~ /vendor/.*.php$ {
    deny all;
    return 404;
    }

    location ~ '.php$|^/update.php' {
    expires off;
    fastcgi_split_path_info ^(.+?.php)(|/.*)$;
    include fastcgi_params;
    fastcgi_param HTTP_PROXY "";
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    fastcgi_param PATH_INFO $fastcgi_path_info;
    fastcgi_param QUERY_STRING $query_string;
    fastcgi_intercept_errors on;
    fastcgi_pass unix:/var/run/php/php7.3-fpm.sock;
    }

    location ~ ^/sites/.*/files/styles/ {
    try_files $uri @rewrite;
    }

    location ~ ^(/[a-z-]+)?/system/files/ {
    try_files $uri /index.php?$query_string;
    }

    location ~* .(js|css|png|jpg|jpeg|gif|ico|svg)$ {
    try_files $uri @rewrite;
    expires max;
    log_not_found off;
    }
    }

    server {
    listen 80;
    server_name www.domaine.com domaine.com;
    return 301 https://$server_name$request_uri;
    }

    server {
    listen 443;
    server_name domaine.com;
    return 301 https://www.$server_name$request_uri;
    }


    sudo nano /etc/nginx/sites-available/analytics-domaine-com



    server {
    listen 443 ssl http2;
    server_name analytics.domaine.com;
    root /var/www/analytics-domaine-com/web;
    report.html;

    auth_basic "Protected";
    auth_basic_user_file /var/www/analytics-domaine-com/web/.htpasswd;

    ssl_certificate /etc/letsencrypt/live/analytics.domaine.com/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/analytics.domaine.com/privkey.pem;
    include /etc/letsencrypt/options-ssl-nginx.conf;
    ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem;
    }

    server {
    listen 80;
    server_name analytics.domaine.com;
    return 301 https://$server_name$request_uri;
    }


    sudo nano /etc/nginx/sites-available/monitoring-domaine-com



    upstream backend {
    server 127.0.0.1:19999;
    keepalive 64;
    }

    server {
    listen 443 ssl http2;
    server_name monitoring.domaine.com;
    root /var/www/monitoring-domaine-com/web;

    auth_basic "Protected";
    auth_basic_user_file /var/www/monitoring-domaine-com/web/.htpasswd;

    ssl_certificate /etc/letsencrypt/live/monitoring.domaine.com/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/monitoring.domaine.com/privkey.pem;
    include /etc/letsencrypt/options-ssl-nginx.conf;
    ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem;

    location / {
    proxy_set_header X-Forwarded-Host $host;
    proxy_set_header X-Forwarded-Server $host;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_pass http://backend;
    proxy_http_version 1.1;
    proxy_pass_request_headers on;
    proxy_set_header Connection "keep-alive";
    proxy_store off;
    }
    }

    server {
    listen 80;
    server_name monitoring.domaine.com;
    return 301 https://$server_name$request_uri;
    }








    share







    New contributor




    ML19 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
    Check out our Code of Conduct.























      0












      0








      0








      I'm starting with Nginx.



      I installed on my server:




      • 1 Drupal site on www.domaine.com

      • 1 GoAccess site on analytics.omaine.com

      • 1 Netdata site on monitoring.domaine.com


      The IP address and domain.com must redirect to www.domain.com



      All domain and subdomain dovent redirect to https



      On my OVH web host, I created domains domain.com www.domain.com analytics.domain.com monitoring.domain.com pointing to the IP address of my server.



      When I enter the IP address of my server in the browser's address bar, it redirects to analytics.domaine.com why ?



      How to redirect to www.domain.com ?



      Before creating the configuration for analytics.domain.com and monitoring.domain.com it worked.



      When I test my configuration :



      sudo nginx -t



      nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
      nginx: configuration file /etc/nginx/nginx.conf test is successful


      sudo nano /etc/nginx/sites-available/www-domaine-com



      server {
      listen 443 ssl http2;
      listen [::]:443 ssl ipv6only=on http2;
      server_name www.domaine.com;
      root /var/www/www-domaine-com/web;

      ssl_certificate /etc/letsencrypt/live/domaine.com/fullchain.pem;
      ssl_certificate_key /etc/letsencrypt/live/domaine.com/privkey.pem;
      include /etc/letsencrypt/options-ssl-nginx.conf;
      ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem;

      add_header Strict-Transport-Security "max-age=15768000; includeSubDomains; preload" always;
      add_header X-Content-Type-Options "nosniff" always;
      add_header X-XSS-Protection "1; mode=block" always;
      add_header X-Frame-Options "SAMEORIGIN" always;
      add_header X-Download-Options "noopen" always;
      add_header X-Permitted-Cross-Domain-Policies "none" always;
      add_header Content-Security-Policy "default-src https: data: wss: 'unsafe-inline' 'unsafe-eval'; base-uri 'self';" always;

      gzip on;
      gzip_vary on;
      gzip_proxied any;
      gzip_comp_level 6;
      gzip_types text/css text/javascript text/xml text/plain text/x-component application/javascript application/json application/xml application/rss+xml font/truetype font/opentype application/vnd.ms-fontobject image/svg+xml;

      expires 1209600s;

      location = /favicon.ico {
      log_not_found off;
      access_log off;
      }

      location = /robots.txt {
      allow all;
      log_not_found off;
      access_log off;
      }

      location ~* .(txt|log)$ {
      deny all;
      }

      location ~ ..*/.*.php$ {
      return 403;
      }

      location ~ ^/sites/.*/private/ {
      return 403;
      }

      location ~ ^/sites/[^/]+/files/.*.php$ {
      deny all;
      }

      location ~* ^/.well-known/ {
      allow all;
      }

      location ~ (^|/). {
      return 403;
      }

      location / {
      try_files $uri /index.php?$query_string;
      }

      location @rewrite {
      rewrite ^/(.*)$ /index.php?q=$1;
      }

      location ~ /vendor/.*.php$ {
      deny all;
      return 404;
      }

      location ~ '.php$|^/update.php' {
      expires off;
      fastcgi_split_path_info ^(.+?.php)(|/.*)$;
      include fastcgi_params;
      fastcgi_param HTTP_PROXY "";
      fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
      fastcgi_param PATH_INFO $fastcgi_path_info;
      fastcgi_param QUERY_STRING $query_string;
      fastcgi_intercept_errors on;
      fastcgi_pass unix:/var/run/php/php7.3-fpm.sock;
      }

      location ~ ^/sites/.*/files/styles/ {
      try_files $uri @rewrite;
      }

      location ~ ^(/[a-z-]+)?/system/files/ {
      try_files $uri /index.php?$query_string;
      }

      location ~* .(js|css|png|jpg|jpeg|gif|ico|svg)$ {
      try_files $uri @rewrite;
      expires max;
      log_not_found off;
      }
      }

      server {
      listen 80;
      server_name www.domaine.com domaine.com;
      return 301 https://$server_name$request_uri;
      }

      server {
      listen 443;
      server_name domaine.com;
      return 301 https://www.$server_name$request_uri;
      }


      sudo nano /etc/nginx/sites-available/analytics-domaine-com



      server {
      listen 443 ssl http2;
      server_name analytics.domaine.com;
      root /var/www/analytics-domaine-com/web;
      report.html;

      auth_basic "Protected";
      auth_basic_user_file /var/www/analytics-domaine-com/web/.htpasswd;

      ssl_certificate /etc/letsencrypt/live/analytics.domaine.com/fullchain.pem;
      ssl_certificate_key /etc/letsencrypt/live/analytics.domaine.com/privkey.pem;
      include /etc/letsencrypt/options-ssl-nginx.conf;
      ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem;
      }

      server {
      listen 80;
      server_name analytics.domaine.com;
      return 301 https://$server_name$request_uri;
      }


      sudo nano /etc/nginx/sites-available/monitoring-domaine-com



      upstream backend {
      server 127.0.0.1:19999;
      keepalive 64;
      }

      server {
      listen 443 ssl http2;
      server_name monitoring.domaine.com;
      root /var/www/monitoring-domaine-com/web;

      auth_basic "Protected";
      auth_basic_user_file /var/www/monitoring-domaine-com/web/.htpasswd;

      ssl_certificate /etc/letsencrypt/live/monitoring.domaine.com/fullchain.pem;
      ssl_certificate_key /etc/letsencrypt/live/monitoring.domaine.com/privkey.pem;
      include /etc/letsencrypt/options-ssl-nginx.conf;
      ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem;

      location / {
      proxy_set_header X-Forwarded-Host $host;
      proxy_set_header X-Forwarded-Server $host;
      proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
      proxy_pass http://backend;
      proxy_http_version 1.1;
      proxy_pass_request_headers on;
      proxy_set_header Connection "keep-alive";
      proxy_store off;
      }
      }

      server {
      listen 80;
      server_name monitoring.domaine.com;
      return 301 https://$server_name$request_uri;
      }








      share







      New contributor




      ML19 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.












      I'm starting with Nginx.



      I installed on my server:




      • 1 Drupal site on www.domaine.com

      • 1 GoAccess site on analytics.omaine.com

      • 1 Netdata site on monitoring.domaine.com


      The IP address and domain.com must redirect to www.domain.com



      All domain and subdomain dovent redirect to https



      On my OVH web host, I created domains domain.com www.domain.com analytics.domain.com monitoring.domain.com pointing to the IP address of my server.



      When I enter the IP address of my server in the browser's address bar, it redirects to analytics.domaine.com why ?



      How to redirect to www.domain.com ?



      Before creating the configuration for analytics.domain.com and monitoring.domain.com it worked.



      When I test my configuration :



      sudo nginx -t



      nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
      nginx: configuration file /etc/nginx/nginx.conf test is successful


      sudo nano /etc/nginx/sites-available/www-domaine-com



      server {
      listen 443 ssl http2;
      listen [::]:443 ssl ipv6only=on http2;
      server_name www.domaine.com;
      root /var/www/www-domaine-com/web;

      ssl_certificate /etc/letsencrypt/live/domaine.com/fullchain.pem;
      ssl_certificate_key /etc/letsencrypt/live/domaine.com/privkey.pem;
      include /etc/letsencrypt/options-ssl-nginx.conf;
      ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem;

      add_header Strict-Transport-Security "max-age=15768000; includeSubDomains; preload" always;
      add_header X-Content-Type-Options "nosniff" always;
      add_header X-XSS-Protection "1; mode=block" always;
      add_header X-Frame-Options "SAMEORIGIN" always;
      add_header X-Download-Options "noopen" always;
      add_header X-Permitted-Cross-Domain-Policies "none" always;
      add_header Content-Security-Policy "default-src https: data: wss: 'unsafe-inline' 'unsafe-eval'; base-uri 'self';" always;

      gzip on;
      gzip_vary on;
      gzip_proxied any;
      gzip_comp_level 6;
      gzip_types text/css text/javascript text/xml text/plain text/x-component application/javascript application/json application/xml application/rss+xml font/truetype font/opentype application/vnd.ms-fontobject image/svg+xml;

      expires 1209600s;

      location = /favicon.ico {
      log_not_found off;
      access_log off;
      }

      location = /robots.txt {
      allow all;
      log_not_found off;
      access_log off;
      }

      location ~* .(txt|log)$ {
      deny all;
      }

      location ~ ..*/.*.php$ {
      return 403;
      }

      location ~ ^/sites/.*/private/ {
      return 403;
      }

      location ~ ^/sites/[^/]+/files/.*.php$ {
      deny all;
      }

      location ~* ^/.well-known/ {
      allow all;
      }

      location ~ (^|/). {
      return 403;
      }

      location / {
      try_files $uri /index.php?$query_string;
      }

      location @rewrite {
      rewrite ^/(.*)$ /index.php?q=$1;
      }

      location ~ /vendor/.*.php$ {
      deny all;
      return 404;
      }

      location ~ '.php$|^/update.php' {
      expires off;
      fastcgi_split_path_info ^(.+?.php)(|/.*)$;
      include fastcgi_params;
      fastcgi_param HTTP_PROXY "";
      fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
      fastcgi_param PATH_INFO $fastcgi_path_info;
      fastcgi_param QUERY_STRING $query_string;
      fastcgi_intercept_errors on;
      fastcgi_pass unix:/var/run/php/php7.3-fpm.sock;
      }

      location ~ ^/sites/.*/files/styles/ {
      try_files $uri @rewrite;
      }

      location ~ ^(/[a-z-]+)?/system/files/ {
      try_files $uri /index.php?$query_string;
      }

      location ~* .(js|css|png|jpg|jpeg|gif|ico|svg)$ {
      try_files $uri @rewrite;
      expires max;
      log_not_found off;
      }
      }

      server {
      listen 80;
      server_name www.domaine.com domaine.com;
      return 301 https://$server_name$request_uri;
      }

      server {
      listen 443;
      server_name domaine.com;
      return 301 https://www.$server_name$request_uri;
      }


      sudo nano /etc/nginx/sites-available/analytics-domaine-com



      server {
      listen 443 ssl http2;
      server_name analytics.domaine.com;
      root /var/www/analytics-domaine-com/web;
      report.html;

      auth_basic "Protected";
      auth_basic_user_file /var/www/analytics-domaine-com/web/.htpasswd;

      ssl_certificate /etc/letsencrypt/live/analytics.domaine.com/fullchain.pem;
      ssl_certificate_key /etc/letsencrypt/live/analytics.domaine.com/privkey.pem;
      include /etc/letsencrypt/options-ssl-nginx.conf;
      ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem;
      }

      server {
      listen 80;
      server_name analytics.domaine.com;
      return 301 https://$server_name$request_uri;
      }


      sudo nano /etc/nginx/sites-available/monitoring-domaine-com



      upstream backend {
      server 127.0.0.1:19999;
      keepalive 64;
      }

      server {
      listen 443 ssl http2;
      server_name monitoring.domaine.com;
      root /var/www/monitoring-domaine-com/web;

      auth_basic "Protected";
      auth_basic_user_file /var/www/monitoring-domaine-com/web/.htpasswd;

      ssl_certificate /etc/letsencrypt/live/monitoring.domaine.com/fullchain.pem;
      ssl_certificate_key /etc/letsencrypt/live/monitoring.domaine.com/privkey.pem;
      include /etc/letsencrypt/options-ssl-nginx.conf;
      ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem;

      location / {
      proxy_set_header X-Forwarded-Host $host;
      proxy_set_header X-Forwarded-Server $host;
      proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
      proxy_pass http://backend;
      proxy_http_version 1.1;
      proxy_pass_request_headers on;
      proxy_set_header Connection "keep-alive";
      proxy_store off;
      }
      }

      server {
      listen 80;
      server_name monitoring.domaine.com;
      return 301 https://$server_name$request_uri;
      }






      nginx proxy virtualhost ip ubuntu-18.04





      share







      New contributor




      ML19 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.










      share







      New contributor




      ML19 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.








      share



      share






      New contributor




      ML19 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.









      asked 40 secs ago









      ML19ML19

      83




      83




      New contributor




      ML19 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.





      New contributor





      ML19 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.






      ML19 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.






















          0






          active

          oldest

          votes











          Your Answer








          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "2"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });






          ML19 is a new contributor. Be nice, and check out our Code of Conduct.










          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fserverfault.com%2fquestions%2f956888%2fhow-to-configure-multiple-servers-on-the-same-ip-address-with-nginx%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          0






          active

          oldest

          votes








          0






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes








          ML19 is a new contributor. Be nice, and check out our Code of Conduct.










          draft saved

          draft discarded


















          ML19 is a new contributor. Be nice, and check out our Code of Conduct.













          ML19 is a new contributor. Be nice, and check out our Code of Conduct.












          ML19 is a new contributor. Be nice, and check out our Code of Conduct.
















          Thanks for contributing an answer to Server Fault!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fserverfault.com%2fquestions%2f956888%2fhow-to-configure-multiple-servers-on-the-same-ip-address-with-nginx%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          As a Security Precaution, the user account has been locked The Next CEO of Stack OverflowMS...

          Список ссавців Італії Природоохоронні статуси | Список |...

          Українські прізвища Зміст Історичні відомості |...