viratualbox 가상 컴퓨터 이상 재 부팅 후 ningx 서버 가 웹 사 이 트 를 방문 할 수 없 는 해결 방법

3283 단어
최근 개발 환경 을 구축 하고 있 습 니 다. 주로 mac 에 virtualbox 가상 기 를 설치 한 다음 에 centos 7.0 에 nginx 서버 와 phop - fpm, mariadb 데이터 베 이 스 를 설치 합 니 다. 그러나 mac 가 이상 하 게 재 부팅 되 었 을 때 이전에 설 치 된 사 이 트 는 방문 할 수 없 었 습 니 다. 그 전에 이 문제 에 대해 원인 을 찾 지 못 했 기 때문에 nginx 를 다시 설치 해 야 해결 할 수 있 습 니 다.오늘 또 이 문제 에 부 딪 혔 습 니 다. nginx 의 설정 을 아예 연구 해 보 니 원래 자신의 프로필 이 효력 이 발생 하지 않 았 습 니 다. 메 인 프로필 nginx. conf 가 효력 이 발생 하지 않 았 는 지 생각 했 습 니 다. 검사 해 보 니 역시 다음 과 같은 주요 프로필 의 코드 입 니 다.
 
 

user nobody;

worker_processes 1;

error_log logs/error.log;

error_log logs/error.log notice;

error_log logs/error.log info;

pid logs/nginx.pid;

events {
worker_connections 1024;
}

http {
include mime.types;
default_type application/octet-stream;
#log_format main '$remote_addr - $remote_user [$time_local] "$request" '
# '$status $body_bytes_sent "$http_referer" '
# '"$http_user_agent" "$http_x_forwarded_for"';

#access_log  logs/access.log  main;

sendfile        on;
#tcp_nopush     on;

#keepalive_timeout  0;
keepalive_timeout  65;
include /etc/nginx/conf.d/*.conf;
#gzip  on;
server {
    listen       80;
    server_name  localhost;

    #charset koi8-r;

    #access_log  logs/host.access.log  main;

    location / {
        root   html;
        index  index.html index.htm;
    }

    #error_page  404              /404.html;

    # redirect server error pages to the static page /50x.html
    #
    error_page   500 502 503 504  /50x.html;
    location = /50x.html {
        root   html;
    }

    # proxy the PHP scripts to Apache listening on 127.0.0.1:80
    #
    #location ~ \.php$ {
    #    proxy_pass   http://127.0.0.1;
    #}

    # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
    #
    #location ~ \.php$ {
    #    root           html;
    #    fastcgi_pass   127.0.0.1:9000;
    #    fastcgi_index  index.php;
    #    fastcgi_param  SCRIPT_FILENAME  /scripts$fastcgi_script_name;
    #    include        fastcgi_params;
    #}

    # deny access to .htaccess files, if Apache's document root
    # concurs with nginx's one
    #
    #location ~ /\.ht {
    #    deny  all;
    #}
}


# another virtual host using mix of IP-, name-, and port-based configuration
#
#server {
#    listen       8000;
#    listen       somename:8080;
#    server_name  somename  alias  another.alias;

#    location / {
#        root   html;
#        index  index.html index.htm;
#    }
#}


# HTTPS server
#
#server {
#    listen       443 ssl;
#    server_name  localhost;

#    ssl_certificate      cert.pem;
#    ssl_certificate_key  cert.key;

#    ssl_session_cache    shared:SSL:1m;
#    ssl_session_timeout  5m;

#    ssl_ciphers  HIGH:!aNULL:!MD5;
#    ssl_prefer_server_ciphers  on;

#    location / {
#        root   html;
#        index  index.html index.htm;
#    }
#}

}
마지막 으로 이 유 를 찾 았 습 니 다. 주요 프로필 nginx. conf 가 하위 설정 폴 더 conf. d 를 포함 하지 않 았 기 때문에 다음 과 같은 말 을 더 한 다음 nginx 서버 를 다시 시작 하면 문제 가 해결 되 었 습 니 다.
하위 프로필 추가:

include /etc/nginx/conf.d/*.conf;
서버 재 부팅:

service nginx restart

좋은 웹페이지 즐겨찾기