20,359
社区成员
发帖
与我相关
我的任务
分享
server {
listen 80;
index index.php index.html index.htm;
root /home/deploy/apps/xiaopo.me/current/public;
server_name xiaopo.me www.xiaopo.me;
location / {
try_files $uri $uri/ /index.html;
}
location ~ \.php$ {
try_files $uri = 404;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_index index.php;
fastcgi_pass 127.0.0.1:9000;
include fastcgi_params;
}
}
运行sudo netstat -ntpl
结果:
tcp 0 0 127.0.0.1:9000 0.0.0.0:* LISTEN 6946/php-fpm
ps -aux
结果:
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
root 1 0.0 0.1 2904 884 ? Ss Nov01 0:00 init
root 2 0.0 0.0 0 0 ? S Nov01 0:00 [kthreadd/378775]
root 3 0.0 0.0 0 0 ? S Nov01 0:00 [khelper/378775]
root 169 0.0 0.0 2472 268 ? S<s Nov01 0:00 /sbin/udevd -d
root 595 0.0 0.0 5400 368 ? S<s Nov01 0:00 /root/vpnserver/vpnserver execsvc
root 596 1.1 0.9 31384 4936 ? S<l Nov01 27:50 /root/vpnserver/vpnserver execsvc
root 619 0.0 0.1 8652 584 ? Ss Nov01 0:00 /usr/sbin/sshd
root 673 0.0 0.6 11524 3512 ? Ss Nov01 0:11 /usr/bin/python /usr/bin/ssserver -c /etc/shad
root 696 0.0 0.2 11128 1460 ? Ss Nov01 0:01 /usr/bin/python /usr/bin/ssserver -c /etc/shad
root 718 0.0 0.3 11468 1980 ? Ss Nov01 0:02 /usr/bin/python /usr/bin/ssserver -c /etc/shad
root 6370 0.0 0.6 12144 3448 ? Ss Nov02 0:00 sshd: deploy [priv]
deploy 6372 0.0 0.2 12144 1180 ? S 00:00 0:00 sshd: deploy@pts/0
deploy 6373 0.0 0.2 3160 1524 pts/0 Ss 00:00 0:00 -bash
root 6647 0.0 0.2 3464 1408 pts/0 S 00:41 0:00 su root
root 6648 0.0 0.2 3056 1340 pts/0 S 00:41 0:00 bash
root 6811 0.0 0.1 3072 984 pts/0 S 00:46 0:00 su deploy
deploy 6812 0.0 0.2 3160 1544 pts/0 S 00:46 0:00 bash
root 6919 0.0 0.2 15740 1564 ? Ss 01:16 0:00 nginx: master process /usr/sbin/nginx -c /etc/
nginx 6921 0.0 0.4 15920 2484 ? S 01:16 0:00 nginx: worker process
root 6946 0.0 0.7 161412 3680 ? Ss 01:16 0:00 php-fpm: master process (/etc/php-fpm.conf)
deploy 6948 0.0 0.7 161608 3888 ? S 01:16 0:00 php-fpm: pool www
deploy 6949 0.0 0.7 161608 3904 ? S 01:16 0:00 php-fpm: pool www
deploy 6950 0.0 0.8 161608 4208 ? S 01:16 0:00 php-fpm: pool www
deploy 6982 0.0 0.1 2860 960 pts/0 R+ 01:42 0:00 ps -aux
sudo /etc/init.d/nginx configtest
结果:
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful
location ~ .*\.(php|php5)?$
{
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
include fastcgi.conf;
}
include fastcgi.conf,不要引入fastcgi_params,如果没有fastcgi.conf这个文件复制fastcgi.conf.default即可
<?
phpinfo();
?>
我天,咋回事。。。
error_log /home/deploy/apps/logs/xiaopo.error.log;
access_log /home/deploy/apps/logs/xiaopo.access.log;
重启nginx、php-fpm之后,访问domain/index.php空白,domain/index.html显示内容。。。
在access.log里面能看到访问日志,但是在error_log中并没有错误日志。。。