Adding a dynamic host name to the Nginx configuration file

This commit is contained in:
Vincent Letourneau
2017-09-28 09:50:50 +02:00
parent df3560700b
commit f18aeba421
2 changed files with 43 additions and 43 deletions

View File

@@ -21,28 +21,28 @@ server {
} }
} }
server { # server {
server_name localhost; # server_name localhost;
listen 443 ssl; # listen 443 ssl;
fastcgi_param HTTPS on; # fastcgi_param HTTPS on;
ssl_certificate /etc/ssl/server.pem; # ssl_certificate /etc/ssl/server.pem;
ssl_certificate_key /etc/ssl/server.key; # ssl_certificate_key /etc/ssl/server.key;
ssl_protocols SSLv3 TLSv1 TLSv1.1 TLSv1.2; # ssl_protocols SSLv3 TLSv1 TLSv1.1 TLSv1.2;
index index.php index.html; # index index.php index.html;
error_log /var/log/nginx/error.log; # error_log /var/log/nginx/error.log;
access_log /var/log/nginx/access.log; # access_log /var/log/nginx/access.log;
root /var/www/html/public; # root /var/www/html/public;
location ~ \.php$ { # location ~ \.php$ {
try_files $uri =404; # try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$; # fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass php:9000; # fastcgi_pass php:9000;
fastcgi_index index.php; # fastcgi_index index.php;
include fastcgi_params; # include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; # fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info; # fastcgi_param PATH_INFO $fastcgi_path_info;
} # }
} # }

View File

@@ -3,7 +3,7 @@
server { server {
listen 80 default_server; listen 80 default_server;
listen [::]:80 default_server; listen [::]:80 default_server;
server_name ${NGINX_HOST}; server_name localhost;
index index.php index.html; index index.php index.html;
error_log /var/log/nginx/error.log; error_log /var/log/nginx/error.log;
@@ -21,28 +21,28 @@ server {
} }
} }
server { # server {
server_name ${NGINX_HOST}; # server_name localhost;
listen 443 ssl; # listen 443 ssl;
fastcgi_param HTTPS on; # fastcgi_param HTTPS on;
ssl_certificate /etc/ssl/server.pem; # ssl_certificate /etc/ssl/server.pem;
ssl_certificate_key /etc/ssl/server.key; # ssl_certificate_key /etc/ssl/server.key;
ssl_protocols SSLv3 TLSv1 TLSv1.1 TLSv1.2; # ssl_protocols SSLv3 TLSv1 TLSv1.1 TLSv1.2;
index index.php index.html; # index index.php index.html;
error_log /var/log/nginx/error.log; # error_log /var/log/nginx/error.log;
access_log /var/log/nginx/access.log; # access_log /var/log/nginx/access.log;
root /var/www/html/public; # root /var/www/html/public;
location ~ \.php$ { # location ~ \.php$ {
try_files $uri =404; # try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$; # fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass php:9000; # fastcgi_pass php:9000;
fastcgi_index index.php; # fastcgi_index index.php;
include fastcgi_params; # include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; # fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info; # fastcgi_param PATH_INFO $fastcgi_path_info;
} # }
} # }