こんにちは、nginx と php5-fpm を使用して Web サーバーを構成しようとしている皆さん。
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