0
なぜ私はconflicting server name
例外があるのか分かりません。nginxでサーバ名が競合しています
私は接頭辞にWWW
という要求を受け入れるかどうかを決めます。
return 301 https://$server_name$request_uri;
は、非https要求をhttpsに強制します。
この例外を解決するにはどうすればよいですか?
Nginx.conf
server {
listen 80 ;
server_name myApp.co www.myApp.co;
root /home/deployer/workspace/myApp-web/dist;
error_log /var/log/nginx/myApp_web_error.log warn;
access_log /var/log/nginx/myApp_web_access.log;
listen 443 ssl;
listen [::]:443 ssl;
ssl_certificate /etc/nginx/ssl/myApp_co.bundled.crt;
ssl_certificate_key /etc/nginx/ssl/myApp.key;
large_client_header_buffers 4 4800k;
location/{
try_files $uri $uri/ /index.html ; # make HTML5 workable
gzip on;
gzip_static on;
gzip_min_length 1k;
gzip_comp_level 6;
gzip_types application/javascript text/plain application/x-javascript text/css application/xml text/javascript application/x-httpd-php image/jpeg image/gif image/png;
gzip_vary off;
gzip_disable "MSIE [1-6]\.";
}
location /api/v1 {
proxy_pass http://localhost:7617/api/v1/;
}
}
server {
listen 80;
server_name myApp.co www.myApp.co;
return 301 https://$server_name$request_uri;
}
あなたは同じポートで、同じサーバー名を聞いて2個のサーバー・ブロックを持つことができない例外ログ
2017/12/05 06:54:42 [warn] 6059#0: conflicting server name "myApp.co" on 0.0.0.0:80, ignored
2017/12/05 06:54:42 [warn] 6059#0: conflicting server name "www.myApp.co" on 0.0.0.0:80, ignored
2017/12/05 06:55:05 [warn] 6089#0: conflicting server name "myApp.co" on 0.0.0.0:80, ignored
2017/12/05 06:55:05 [warn] 6089#0: conflicting server name "www.myApp.co" on 0.0.0.0:80, ignored
2017/12/05 06:55:06 [warn] 6093#0: conflicting server name "myApp.co" on 0.0.0.0:80, ignored
あなたは同じ 'listen'と' server_name'値を持つ2つの 'server'ブロックがある - ほとんどあなたが見ている警告を定義します。 –