最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

Nginx啟動顯示80端口占用問題的解決方案

 更新時間:2024年04月29日 11:24:52   作者:SarPro  
這篇文章主要介紹了Nginx啟動顯示80端口占用問題的解決方案,文中通過代碼示例和圖文講解的非常詳細,對大家解決問題有一定的幫助,需要的朋友可以參考下

1. 問題描述

在啟動nginx服務的時候顯示內容如下:

sudo systemctl status nginx

問題出現原因:

根據日志顯示,Nginx 服務啟動失敗,主要原因是無法綁定到端口 80。這通常是由于該端口已被

其他進程占用而導致的。

2. 解決方案

要解決此問題,可以執(zhí)行以下步驟:

確認端口 80 是否被其他進程占用??梢允褂靡韵旅顧z查:

sudo netstat -tuln | grep :80

該命令會列出正在監(jiān)聽端口 80 的進程。如果有其他進程在使用該端口,顯示如下:

打開配置文件:可以將80端口【默認端口】修改為 8080 端口【當然也可以是其他的,不過要記得去防火墻添加規(guī)則(即添加端口)】

比如我添加的是 8080 端口,則添加規(guī)則如下(紅框內容):

可以使用以下命令打開配置文件:

sudo nano /etc/nginx/sites-available/*

我的配置文件內容如下【版本不同當然配置文件不同】:

##
# 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;
	listen [::]:80 default_server;
	# 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
	#
	# Read up on ssl_ciphers to ensure a secure configuration.
	# See: https://bugs.debian.org/765782
	#
	# Self signed certs generated by the ssl-cert package
	# Don't use them in a production server!
	#
	# include snippets/snakeoil.conf;
 
	root /var/www/html;
 
	# Add index.php to the list if you are using PHP
	index index.html index.htm index.nginx-debian.html;
 
	server_name _;
 
	location / {
		# First attempt to serve request as file, then
		# as directory, then fall back to displaying a 404.
		try_files $uri $uri/ =404;
	}
 
	# pass PHP scripts to FastCGI server
	#
	#location ~ \.php$ {
	#	include snippets/fastcgi-php.conf;
	#
	#	# With php-fpm (or other unix sockets):
	#	fastcgi_pass unix:/run/php/php7.4-fpm.sock;
	#	# With php-cgi (or other tcp sockets):
	#	fastcgi_pass 127.0.0.1:9000;
	#}
 
	# deny access to .htaccess files, if Apache's document root
	# concurs with nginx's one
	#
	#location ~ /\.ht {
	#	deny all;
	#}
}
 
 
# Virtual Host configuration for example.com
#
# You can move that to a different file under sites-available/ and symlink that
# to sites-enabled/ to enable it.
#
#server {
#	listen 80;
#	listen [::]:80;
#
#	server_name example.com;
#
#	root /var/www/example.com;
#	index index.html;
#
#	location / {
#		try_files $uri $uri/ =404;
#	}
#}

將里面的代碼模塊

server {
    listen 80 default_server;
    listen [::]:80 default_server;

修改成

server {
    listen 8080 default_server;
    listen [::]:8080 default_server;

完成修改!【如果其他地方還有 80 的修改成 8080 即可】。

啟動Nginx服務

sudo systemctl start nginx

設置Nginx服務自啟動:

sudo systemctl enable nginx

驗證Nginx是否運行:

sudo systemctl status nginx

如果一切正常,輸出應該是“Active: active (running)”或者類似的信息。

以上就是Nginx啟動顯示80端口占用問題的解決方案的詳細內容,更多關于Nginx 80端口占用的資料請關注腳本之家其它相關文章!

相關文章

  • NGINX詳細下載安裝及使用入門教程

    NGINX詳細下載安裝及使用入門教程

    Nginx是一種高性能的Web服務器軟件,它可以處理大量的并發(fā)連接,并且可以緩存HTTP請求以提高性能,本文給大家介紹NGINX詳細下載安裝及使用入門教程,感興趣的朋友跟隨小編一起看看吧
    2024-10-10
  • Nginx防止惡意域名解析過程

    Nginx防止惡意域名解析過程

    Nginx防止惡意域名解析,通過編輯nginx.conf文件添加限制配置,確保網站安全合規(guī),避免服務器IP被關閉處理
    2026-05-05
  • 高性能軟件負載OpenResty介紹和安裝使用詳解

    高性能軟件負載OpenResty介紹和安裝使用詳解

    OpenResty是一個基于?Nginx?與?Lua?的高性能?Web?平臺,其內部集成了大量精良的?Lua?庫、第三方模塊以及大多數的依賴項,這篇文章主要介紹了高性能軟件負載OpenResty介紹和安裝,需要的朋友可以參考下
    2023-12-12
  • nginx配置虛擬主機的詳細步驟

    nginx配置虛擬主機的詳細步驟

    虛擬主機提供了在同一臺服務器、同一組Nginx進程上運行多個網站的功能。本文通過三種方法給大家介紹配置虛擬主機的方法,感興趣的朋友跟隨小編一起看看吧
    2021-07-07
  • Nginx配置多個訪問路徑的實現

    Nginx配置多個訪問路徑的實現

    本文主要介紹了Nginx配置多個訪問路徑的實現,Nginx通過配置多個service就可以實現多訪問路徑,具有一定的參考價值,感興趣的可以了解一下
    2023-10-10
  • Nginx?處理請求并發(fā)控制的過程分享

    Nginx?處理請求并發(fā)控制的過程分享

    Nginx?作為一款高性能的?Web?服務器和反向代理服務器,在處理請求的并發(fā)控制方面有著出色的表現,這篇文章主要介紹了Nginx?處理請求的并發(fā)控制的過程,需要的朋友可以參考下
    2024-07-07
  • Nginx?生產環(huán)境安全配置加固的實現

    Nginx?生產環(huán)境安全配置加固的實現

    本文主要介紹了Nginx?生產環(huán)境安全配置加固的實現,文中通過示例代碼介紹的非常詳細,對大家的學習或者工作具有一定的參考學習價值,需要的朋友們下面隨著小編來一起學習學習吧
    2025-03-03
  • nginx配置https的方法示例(免費證書)

    nginx配置https的方法示例(免費證書)

    這篇文章主要介紹了nginx配置https的方法示例(免費證書),小編覺得挺不錯的,現在分享給大家,也給大家做個參考。一起跟隨小編過來看看吧
    2018-03-03
  • CentOS利用Nginx搭建下載功能服務器

    CentOS利用Nginx搭建下載功能服務器

    這篇文章主要介紹了CentOS利用Nginx搭建下載功能服務器,需要的朋友可以參考下
    2017-06-06
  • Linux下nginx編譯安裝教程和編譯參數詳解

    Linux下nginx編譯安裝教程和編譯參數詳解

    這篇文章主要介紹了Linux下nginx編譯安裝教程和編譯參數詳解,需要的朋友可以參考下
    2014-04-04

最新評論

万宁市| 保定市| 滦平县| 新沂市| 新巴尔虎左旗| 泸定县| 济南市| 安溪县| 卓尼县| 波密县| 武强县| 区。| 洱源县| 纳雍县| 胶南市| 达孜县| 贡觉县| 浑源县| 上犹县| 噶尔县| 巴林右旗| 蓬安县| 金平| 岱山县| 遂溪县| 吉木萨尔县| 孟村| 通山县| 万州区| 辛集市| 侯马市| 邹平县| 海南省| 尼木县| 剑河县| 油尖旺区| 阿拉善右旗| 罗甸县| 勐海县| 榆树市| 兰坪|