大家好,尝试使用 nginx 和 php5-fpm 配置我的网络服务器。
当我尝试重新启动/启动/停止 nginx 时,它显示:
Restarting nginx:
nginx: [emerg] bind() to [::]:80 failed (98: Address already in use)
nginx: [emerg] bind() to [::]:80 failed (98: Address already in use)
nginx: [emerg] bind() to [::]:80 failed (98: Address already in use)
nginx: [emerg] bind() to [::]:80 failed (98: Address already in use)
nginx: [emerg] bind() to [::]:80 failed (98: Address already in use)
nginx: [emerg] still could not bind()
nginx.
日志显示同样的事情。
我的网站配置:
server {
listen 80;
listen [::]:80;
root /home/marker/Projects/stereoshoots/www;
server_name stereoshoots.local;
location / {
autoindex on;
# try_files $uri $uri/ @rewrite;
try_files $uri $uri/ /index.php;
}
# location @rewrite {
# rewrite ^/(.*)$ /index.php?q=$1;
# }
location ~* \.(jpg|jpeg|gif|css|png|js|ico|xml|txt)$ {
access_log off;
expires 30d;
}
location = /favicon.ico {
return 204;
access_log off;
log_not_found off;
}
location ~ \.php$ {
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;
}
location ~ /\.ht {
deny all;
}
}
我在终端中编写的命令列表,同时正在安装 nginx+php5-fpm
1.sudo apt-get install nginx
2.sudo apt-get install php5-cli php5-common php5-mysql php5-suhosin php5-gd php5-fpm php5-cgi php5-fpm php-pear php5-mcrypt
3.sudo service nginx stop
4.sudo service php5-fpm stop
5.sudo gedit /etc/php5/fpm/php.ini
cgi.fix_pathinfo = 0;
6.sudo gedit /etc/php5/fpm/pool.d/www.conf
security.limit_extensions = .php .php3 .php4 .php5
listen = /var/run/php5-fpm.sock