nginx 80端口被 ‘welcome to nginx‘ 欢迎界面占用,无法使用

问题描述:

nginx 配置使用80端口,自动跳转到欢迎页面(welcome to nginx!),但是其他端口可以正常使用

解决方法:

配置文件目录:

/etc/nginx/sites-enables/

在这个目录下面除了在自己写的配置文件(×××.conf)外还有一个default文件,这个文件是默认加载的而配置文件,编辑这个default文件,打开以后是这样的:

##
# You should look at the following URL's in order to grasp a solid understanding
# of Nginx configuration files in order to fully unleash the power of Nginx.
# https://www.nginx.com/resources/wiki/start/
# https://www.nginx.com/resources/wiki/start/topics/tutorials/config_pitfalls/
# https://wiki.debian.org/Nginx/DirectoryStructure
#
# In most cases, administrators will remove this file from sites-enabled/ and
# leave it as reference inside of sites-available where it will continue to be
# updated by the nginx packaging team.
#
# This file will automatically load configuration files provided by other
# applications, such as Drupal or Wordpress. These applications will be made
# available underneath a path with that package name, such as /drupal8.
#
# Please see /usr/share/doc/nginx-doc/examples/ for more detailed examples.
##

# Default server configuration
#
server {
	listen 80 default_server;  ## 这里默认欢迎页面是80端口,把这个端口改成一个不用的端口号
	listen [::]:80 default_server;   ## 这里默认欢迎页面是80端口,改成一个不用的端口号

	# SSL configuration
	#
	# listen 443 ssl default_server;
	# listen [::]:443 ssl default_server;
	#
	# Note: You should disable gzip for SSL traffic.
	# See: https://bugs.debian.org/773332

可以看见里面欢迎页面默认的被80端口占用,改成其他的端口即可解决被占用的问题。

最后kill pid,重新启动nginx ,输入url,问题解决。




猜你喜欢

转载自blog.csdn.net/lhs960124/article/details/80208447