어떻게 두 서버간에 공통 구성을 공유 할 수 있습니다. 내 애플 리케이션은 HTTP 및 https (몇 페이지)를 지원하며 현재 DB 이름과 암호 같은 중요한 정보를 저장하기 위해 fastcgi_param을 사용하고 있습니다. 두 서버 (80, 443)에 대해 위치와 fastcgi_param을 어떻게 공유 할 수 있습니까?공유 Nginx 서버 구성
server { listen 80; server_name example.com; } server { listen 443 ssl; server_name example.com; root /home/forge/example.com/public; # FORGE SSL (DO NOT REMOVE!) ssl on; ssl_certificate /etc/nginx/ssl/example.com/304/server.crt; ssl_certificate_key /etc/nginx/ssl/example.com/304/server.key; index index.html index.htm index.php; charset utf-8; location/{ try_files $uri $uri/ /index.php?$query_string; } location = /favicon.ico { access_log off; log_not_found off; } location = /robots.txt { access_log off; log_not_found off; } access_log off; error_log /var/log/nginx/example.com-error.log error; error_page 404 /index.php; location ~ \.php$ { fastcgi_param ENV "production"; fastcgi_param DB_HOST "127.0.0.1"; fastcgi_param DB_PASSWORD "123456"; fastcgi_param DB_USERNAME "user"; fastcgi_param DB_NAME "example"; fastcgi_split_path_info ^(.+\.php)(/.+)$; fastcgi_pass unix:/var/run/php5-fpm.sock; fastcgi_index index.php; include fastcgi_params; } location ~ /\.ht { deny all; } }
의 conf 내가 공유하려는 :
index index.html index.htm index.php; charset utf-8; location/{ try_files $uri $uri/ /index.php?$query_string; } location = /favicon.ico { access_log off; log_not_found off; } location = /robots.txt { access_log off; log_not_found off; } access_log off; error_log /var/log/nginx/example.com-error.log error; error_page 404 /index.php; location ~ \.php$ { fastcgi_param ENV "production"; fastcgi_param DB_HOST "127.0.0.1"; fastcgi_param DB_PASSWORD "123456"; fastcgi_param DB_USERNAME "user"; fastcgi_param DB_NAME "example"; fastcgi_split_path_info ^(.+\.php)(/.+)$; fastcgi_pass unix:/var/run/php5-fpm.sock; fastcgi_index index.php; include fastcgi_params; } location ~ /\.ht { deny all; }
는 http://nginx.org/en/docs/http/configuring_https_servers.html#single_http_https_server 나는 http://nginx.org/en (당신은 당신이 필요이 –
은 [포함]해야 할 것 같아요 /docs/ngx_core_module.html#include) 서버 블록에있는 파일. – vutran