技术解析
手贱重启了 openresty,突然站点就 403 forbidden。搞了一天了,真心累,请教同学们。
配置环境:centos7+openresty(nginx)+php+mysql systemctl status openresty ,systemctl status php-fpm,systemctl status mysql,都是 active status,绿色。
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
nginx 32255 root 6u IPv4 170338 0t0 TCP localhost:http (LISTEN)
nginx 32332 root 6u IPv4 170338 0t0 TCP localhost:http (LISTEN)
tcp 0 0 127.0.0.1:80 0.0.0.0:* LISTEN
unix 2 [ ACC ] STREAM LISTENING 28071 /var/lib/mysql/mysql.sock
unix 3 [ ] STREAM CONNECTED 11800
unix 3 [ ] STREAM CONNECTED 11801 /run/systemd/journal/stdout
ps aux | gre美国服务器p php
root 19363 0.0 3.1 470292 31572 ? Ss 00:20 0:04 php-fpm: master process (/etc/ph-fpm.conf)
nginx 19364 0.0 0.7 470292 7228 ? S 00:20 0:00 php-fpm: pool www
nginx 19365 0.0 0.7 470292 7228 ? S 00:20 0:00 php-fpm: pool www
nginx 19366 0.0 0.7 470292 7228 ? S 00:20 0:00 php-fpm: pool www
nginx 19367 0.0 0.7 470292 7228 ? S 00:20 0:00 php-fpm: pool www
nginx 19368 0.0 0.7 470292 7232 ? S 00:20 0:00 php-fpm: pool www
nginx 19369 0.0 0.7 470292 7232 ? S 00:20 0:00 php-fpm: pool www
nginx 19370 0.0 0.7 470292 7232 ? S 00:20 0:00 php-fpm: pool www
nginx 19371 0.0 0.7 470292 7232 ? S 00:20 0:00 php-fpm: pool www
root 32204 0.0 0.0 112704 968 pts/0 R+ 17:57 0:00 grep --color=auto php
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 127.0.0.1:80 0.0.0.0:* LISTEN 32255/nginx: master
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 730/sshd
tcp 0 0 45.79.66.57:22 113.118.253.226:4315 ESTABLISHED 32434/sshd: [email protected]
tcp 0 36 45.79.66.57:22 113.118.253.226:4860 ESTABLISHED 32584/sshd: [email protected]
tcp 0 0 45.79.66.57:22 113.118.253.226:3505 ESTABLISHED 32115/sshd: [email protected]
tcp6 0 0 :::9000 :::* LISTEN 19363/php-fpm: mast
tcp6 0 0 :::3306 :::* LISTEN 3299/mysqld
tcp6 0 0 :::22 :::* LISTEN 730/sshd
/usr/local/openresty/nginx/conf/nginx.conf
user root;
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;
client_max_body_size 8m; #允许客户端请求的最大单文件字节数
client_body_buffer_size 2m; #缓冲区代理缓冲用户端请求的最大字节
fastcgi_buffers 8 16k;
fastcgi_buffer_size 32k;
fastcgi_connect_timeout 300;
fastcgi_send_timeout 300;
fastcgi_read_timeout 300;
gzip on;
#WAF
lua_shared_dict limit 50m;
lua_shared_dict guard_dict 100m;
lua_shared_dict dict_captcha 70m;
lua_package_path "/usr/local/openresty/nginx/conf/waf/?.lua";
init_by_lua_file "/usr/local/openresty/nginx/conf/waf/init.lua";
access_by_lua_file "/usr/local/openresty/nginx/conf/waf/access.lua";
server {
listen 127.0.0.1;
server_name kiwikiwifly.com;
#charset koi8-r;
#access_log logs/host.access.log main;
location / {
root html;
index index.php 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 $document_root$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;
# }
#}
}
and /usr/local/openresty/nginx/logs/error.log
2018/06/26 21:27:10 [alert] 740#740: *7927 open socket #10 left in connection 12
2018/06/26 21:27:10 [alert] 740#740: *7926 open socket #3 left in connection 13
2018/06/26 21:27:10 [alert] 740#740: aborting
只有到 26 号 error.log