请稍等 ...
×

采纳答案成功!

向帮助你的同学说点啥吧!感谢那些助人为乐的人

我打开一个网页,如果我一段时间不刷新,就停止了,要重新启动nginx服务器,请问怎么设置

#user nobody;
worker_processes auto;
worker_rlimit_nofile 51200;

#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;

#pid logs/nginx.pid;

events {
use epoll;
worker_connections 51200;
multi_accept on;

}

http {
include mime.types;
default_type application/octet-stream;
send_timeout 30s;
client_body_timeout 20;
client_header_timeout 15;
#log_format main '$remote_addr - remoteuser[remote_user [remoteuser[time_local] “KaTeX parse error: Expected 'EOF', got '#' at position 16: request" ' #̲ …status bodybytessent"body_bytes_sent "bodybytessent"http_referer” '
# ‘“httpuseragent""http_user_agent" "httpuseragent""http_x_forwarded_for”’;

#access_log  logs/access.log  main;

sendfile       on;
tcp_nopush     on;
tcp_nodelay    on;
keepalive_timeout 120;

#gzip  on;

server {
    listen       80;
    server_name  _;
    access_log /data/wwwlogs/access_nginx.log combined;
root /data/wwwroot/default;
index index.html index.htm index.php;
location /nginx_status {
       stub_status on;
       access_log off;
       allow 127.0.0.1;
       deny all;
}


    #error_page  404              /404.html;

    # redirect server error pages to the static page /50x.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           /data/wwwroot/;
      fastcgi_pass   127.0.0.1:9000;
      fastcgi_index  index.php;
      fastcgi_param  SCRIPT_FILENAME  /scripts$fastcgi_script_name;
      include        fastcgi_params;
   }
  #
location ~ .*\.(gif|jpg|jpeg|png|bmp|swf|flv|mp4|ico)$ {
    expires 30d;
    access_log off;
}
location ~ .*\.(js|css)?$ {
    expires 7d;
    access_log off;
}
location ~ ^/(\.user.ini|\.ht|\.git|\.svn|\.project|LICENSE|README.md) {
    deny all;
}


    # 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;
#    }
#}
########################## vhost #############################
include vhost/*.conf;

}

正在回答 回答被采纳积分+3

1回答

Jeson 2021-07-08 08:55:11

查看“

我打开一个网页,如果我一段时间不刷新,就停止了


这个时候的页面访问时候,nginx的访问日志

0 回复 有任何疑惑可以回复我~
  • 提问者 7爷丶 #1
    我在重启的时候,一二步正常,域名可以正常访问,然后到了第三步的时候,服务器就挂了,访问失败了
    一、[root@VM-0-2-centos ~]# service nginx restart
    二、Redirecting to /bin/systemctl restart nginx.service
    三、Job for nginx.service failed because a timeout was exceeded.
    四、See "systemctl status nginx.service" and "journalctl -xe" for details.
    回复 有任何疑惑可以回复我~ 2021-07-08 10:10:18
问题已解决,确定采纳
还有疑问,暂不采纳
意见反馈 帮助中心 APP下载
官方微信