前提・実現したいこと
SSL化を試みていたものの失敗し、HTTP接続に戻そうと試みてNginx設定ファイルを元に戻そうとしたところ、元の記述がわからなくなってしまいました。
nginx.confの38行目の記述が間違っているところまでは分かったのですが、どのような記載だったかわかりませんので教えていただけると幸いです。
発生している問題・エラーメッセージ
nginx: [emerg] "server" directive is not allowed here in /etc/nginx/nginx.conf:38 nginx: configuration file /etc/nginx/nginx.conf test failed nginx.service: control process exited, code=exited status=1 Failed to start The nginx HTTP and reverse proxy server. Unit nginx.service entered failed state. nginx.service failed.
該当のソースコード
nginx.conf
1# For more information on configuration, see: 2# * Official English Documentation: http://nginx.org/en/docs/ 3# * Official Russian Documentation: http://nginx.org/ru/docs/ 4 5user nginx; 6worker_processes auto; 7error_log /var/log/nginx/error.log; 8pid /run/nginx.pid; 9 10# Load dynamic modules. See /usr/share/doc/nginx/README.dynamic. 11include /usr/share/nginx/modules/*.conf; 12 13events { 14 worker_connections 1024; 15} 16 17http { 18 log_format main '$remote_addr - $remote_user [$time_local] "$request" ' 19 '$status $body_bytes_sent "$http_referer" ' 20 '"$http_user_agent" "$http_x_forwarded_for"'; 21 22 access_log /var/log/nginx/access.log main; 23 24 sendfile on; 25 tcp_nopush on; 26 tcp_nodelay on; 27 keepalive_timeout 65; 28 types_hash_max_size 4096; 29 30 include /etc/nginx/mime.types; 31 default_type application/octet-stream; 32 33 # Load modular configuration files from the /etc/nginx/conf.d directory. 34 # See http://nginx.org/en/docs/ngx_core_module.html#include 35 # for more information. 36 include /etc/nginx/conf.d/*.conf; 37} 38 39 server { 40 listen 80; 41 server_name localhost; 42 43 # Load configuration files for the default server block. 44 include /etc/nginx/default.d/*.conf; 45 46 location / { 47 } 48 49 error_page 404 /404.html; 50 location = /40x.html { 51 } 52 53 error_page 500 502 503 504 /50x.html; 54 location = /50x.html { 55 } 56 } 57 58# Settings for a TLS enabled server. 59# 60# server { 61# listen 443 ssl http2; 62# listen [::]:443 ssl http2; 63# server_name www.inspection-record.com; 64# root /usr/share/nginx/html; 65# 66# ssl_certificate "/etc/pki/nginx/server.crt"; 67# ssl_certificate_key "/etc/pki/nginx/private/server.key"; 68# ssl_session_cache shared:SSL:1m; 69# ssl_session_timeout 10m; 70# ssl_ciphers PROFILE=SYSTEM; 71# ssl_prefer_server_ciphers on; 72# 73# # Load configuration files for the default server block. 74# include /etc/nginx/default.d/*.conf; 75# 76# error_page 404 /404.html; 77# location = /40x.html { 78# } 79# 80# error_page 500 502 503 504 /50x.html; 81# location = /50x.html { 82# } 83# } 84 85} 86
試したこと
server_name localhost; の追記
Nginxのリロード、再起動
回答1件
あなたの回答
tips
プレビュー