我无法让我的networking服务器(nginx)与php-fpm一起工作。 页面不断加载,然后加载时间到期。
我希望你们其中一位能帮我解决这个问题。 我已经导出了我的活动iptables规则,希望能够弄清楚什么是错误的。
Chain INPUT (policy DROP 0 packets, 0 bytes) pkts bytes target prot opt in out source destination 9962 1071K fail2ban-ssh tcp -- any any anywhere anywhere multiport dports ssh 0 0 ACCEPT all -- lo any anywhere anywhere 9982 1106K ACCEPT all -- any any anywhere anywhere state RELATED,ESTABLISHED 439 25076 ACCEPT tcp -- any any anywhere anywhere state NEW tcp dpt:ssh 117 5964 ACCEPT tcp -- any any anywhere anywhere state NEW tcp dpt:http 24 1372 ACCEPT tcp -- any any anywhere anywhere state NEW tcp dpt:ftp 15 620 ACCEPT tcp -- any any anywhere anywhere state NEW tcp dpts:20000:30000 88 4280 ACCEPT tcp -- any any anywhere anywhere state NEW tcp dpt:https 54 2438 ACCEPT icmp -- any any anywhere anywhere limit: avg 100/sec burst 100 0 0 ACCEPT icmp -- any any anywhere anywhere limit: avg 1/sec burst 10 2110 110K syn-flood tcp -- any any anywhere anywhere tcp flags:FIN,SYN,RST,ACK/SYN 2687 163K REJECT all -- any any anywhere anywhere reject-with icmp-host-prohibited Chain FORWARD (policy ACCEPT 0 packets, 0 bytes) pkts bytes target prot opt in out source destination Chain OUTPUT (policy ACCEPT 85 packets, 14451 bytes) pkts bytes target prot opt in out source destination Chain fail2ban-ssh (1 references) pkts bytes target prot opt in out source destination 7951 908K RETURN all -- any any anywhere anywhere Chain syn-flood (1 references) pkts bytes target prot opt in out source destination 2110 110K RETURN tcp -- any any anywhere anywhere limit: avg 3/sec burst 6 0 0 REJECT all -- any any anywhere anywhere reject-with icmp-port-unreachable
谢谢回复。 它似乎不是在我的iptables。
server { listen 80; server_name <my domain>.<my tld>; access_log /data/wwwlogs/<mydomain>.<mytld>_nginx.log combined; index index.html index.htm index.php; include /etc/nginx/conf/rewrite/none.conf; root /data/wwwroot/<mydomain>.<mytld>; location ~ [^/]\.php(/|$) { #fastcgi_pass remote_php_ip:9000; fastcgi_pass unix:/dev/shm/php-cgi.sock; fastcgi_index index.php; include fastcgi.conf; } location ~ .*\.(gif|jpg|jpeg|png|bmp|swf|flv|ico)$ { expires 30d; access_log off; } location ~ .*\.(js|css)?$ { expires 7d; access_log off; } }
我需要说明的是,我对于iptables和使用linux的初学者毫无经验。
如果没有自己testing,我不能确定,但似乎这只是一个不正确的正则expression式行的情况下,将请求引导到您的php-fpm引擎。
location ~ [^/]\.php(/|$) {
只会匹配以“.php /”(不常见)结尾的位置请求,或者以“.php”明确结尾。 我假设你在这里使用了指南,这很好(虽然我从来没有见过这样的人),但是如果你没有包含if语句,那么可能会导致请求被破坏。 也有可能咬你的问题,如果你没有设置类似的东西
fastcgi_param SCRIPT_FILENAME /your/php/path/$fastcgi_script_name;
(例如,在fastcgi.conf隐式地使用$ document_root),你可能会指向错误的path。
另外两点需要注意的是,你没有location /块来处理所有其他的请求,这些请求在你的根目录下没有被明确地find,最后你已经在上面列出了你的php块,是不正确的 – 它会尝试匹配URI的结尾在PHP首先,而不是匹配和服务静态文件(JPG,ico等),这通常是你想要的。