1 2 3 4 5 6 7 | apt-get install mysql-server apt-get install php5 apt-get install php5-mcrypt apt-get install php5-mysql apt-get install php5-xdebug apt-get install php5-cgi apt-get install nginx |
1 2 3 4 5 6 7 8 9 10 | root@hywd:/etc/nginx/sites-available# service nginx restart Restarting nginx: the configuration file /etc/nginx/nginx.conf syntax is ok configuration file /etc/nginx/nginx.conf test is successful [emerg]: bind() to 0.0.0.0:80 failed (98: Address already in use) [emerg]: bind() to 0.0.0.0:80 failed (98: Address already in use) [emerg]: bind() to 0.0.0.0:80 failed (98: Address already in use) [emerg]: bind() to 0.0.0.0:80 failed (98: Address already in use) [emerg]: bind() to 0.0.0.0:80 failed (98: Address already in use) [emerg]: still could not bind() nginx. |
1 | lsof -i tcp:80 |
1 2 3 4 5 6 7 8 9 | root@hywd:/etc/nginx/sites-available# lsof -i tcp:80 COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME apache2 921 root 3u IPv4 4548 0t0 TCP *:www (LISTEN) apache2 4349 www-data 3u IPv4 4548 0t0 TCP *:www (LISTEN) apache2 4350 www-data 3u IPv4 4548 0t0 TCP *:www (LISTEN) apache2 4351 www-data 3u IPv4 4548 0t0 TCP *:www (LISTEN) apache2 4352 www-data 3u IPv4 4548 0t0 TCP *:www (LISTEN) apache2 4353 www-data 3u IPv4 4548 0t0 TCP *:www (LISTEN) apache2 4429 www-data 3u IPv4 4548 0t0 TCP *:www (LISTEN) |
发现80端口被 apache2占用,卸载之:
1 2 | /etc/init.d/apache2 stop apt-get remove apache2 |
如果不能卸载,那就先装一下,再卸载。
默认站点配置:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 | root@hywd:/etc/nginx/sites-available# cat default # You may add here your # server { # ... # } # statements for each of your virtual hosts server { listen 80 default; server_name localhost; access_log /var/log/nginx/localhost.access.log; location / { root /var/www/nginx-default; index index.html index.htm; } location /doc { root /usr/share; autoindex on; allow 127.0.0.1; deny all; } location /images { root /usr/share; autoindex on; } 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 /var/www/nginx-default; } # 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$ { fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME /var/www/nginx-default/$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; } } |
注意如果 fastcgi_param SCRIPT_FILENAME 不正确,访问PHP文件时会提示:No input file specified.
1 2 | service nginx restart php-cgi -b 127.0.0.1:9000 & |
参考:http://www.howtoforge.com/installing-php-5.3-nginx-and-php-fpm-on-ubuntu-debian
http://interfacelab.com/nginx-php-fpm-apc-awesome/
http://www.softwareprojects.com/resources/programming/t-how-to-install-php-fpm-spawn-fcgi-replacement-1602.html
http://wiki.nginx.org/Nginx-init-ubuntu
http://till.klampaeckel.de/blog/archives/51-Ubuntu-nginx+php-cgi-on-a-socket.html
喜欢这篇文章吗?
请订阅本站 RSS feed 或




回复 (0)