1

大家好,尝试使用 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
4

2 回答 2

1

如果你想同时支持 ipv4 和 ipv6(你应该支持,因为像 Apple 这样的公司已经转移到 ipv6-only 网络,2016.8,截至目前),你需要删除listen 80并只在你的 nginx 配置中保留以下内容,

listen [::]:80

也许还有这个,

listen [::]:443

请记住,您需要将配置中的所有 ,listen 80更改listen 443listen [::]:80, listen [::]:443。不要忘记里面的配置/etc/nginx/sites-available/default

于 2016-08-05T04:19:05.567 回答
0

Skype 默认使用端口 80,443,这些端口正是 http 和 https 端口。尝试关闭Skype并重新启动nginx。

如果您使用的是 Skype 的“桌面版”,您可以通过tools>options>advanced>connections > untick use port 80 and 443 as alternatives.

如果您使用的是 win8 应用程序,唯一的选择似乎是完全关闭 Skype 或完全删除它。

有人必须确认win8应用程序,我使用linux。

于 2013-08-02T19:39:06.517 回答