當前位置:首頁 » 操作系統 » linuxapache埠

linuxapache埠

發布時間: 2022-08-04 03:36:26

1. 如何更改linux下的Apache埠號

Apache的埠號是在其目錄下的
httpd.conf這個文件中設置的。
Apache是跨平台的軟體,在linux/windows/unix下都有相應的版本。
找到apache目錄下的httpd.conf,
使用vi打開,找到port=80
這一行,把80改成在此伺服器上沒有用到的埠號,保存退出。
然後重新啟動apache進程即可。
如果你用rpm包安裝的apache,那麼你的主配置文件應該是在/etc/httpd/conf/httpd.conf這里;
如果你用tar包安裝的apache,那麼應該在你apache安裝目錄下的conf/httpd.conf這里;
如果apache是在/usr/local/apache2安裝的,那麼主配置文件就在/usr/local/apache2/conf/httpd.conf這里.

2. linux中,怎麼查詢apache是否啟動,怎麼查埠號

1、檢查進程
ps -ef|grep http
2、檢查埠
netstat -ntlp

3. linux下關於apache埠的問題,高手請進

首先你要找到你的apache上的配置文件httpd.conf,用記事本打開,
找到Listen <你的ip>:80
或者Listen:80
添加或更改為你要添加的埠(不能有沖突)如下面的例子:
Listen 80
Listen 81
Listen 82
再建立虛擬主機,你看看我的機器上的:

NameVirtualHost localhost:80
NameVirtualHost localhost:81
NameVirtualHost localhost:82
<VirtualHost localhost:80>
DocumentRoot f:\skywatcher\web\
ServerName localhost:80
</VirtualHost>
<VirtualHost localhost:81>
ServerAdmin [email protected]
DocumentRoot f:\skywatcher\web1\
ServerName locahost:81
</VirtualHost>
<VirtualHost localhost:82
DocumentRoot f:\skywatcher\web\phpmyadmin
ServerName localhost:82
</VirtualHost>

這里只是舉例,需要按照實際的路徑、埠設置,配置文件在不確認操作是否會帶來不利的影響的情況下一定要先備份啊!

4. 如何更改linux下的Apache埠號

Apache的埠號是在其目錄下的 httpd.conf這個文件中設置的。

Apache是跨平台的軟體,在linux/windows/unix下都有相應的版本。

找到apache目錄下的httpd.conf, 使用vi打開,找到port=80 這一行,把80改成在此伺服器上沒有用到的埠號,保存退出。

然後重新啟動apache進程即可。

如果你用rpm包安裝的apache,那麼你的主配置文件應該是在/etc/httpd/conf/httpd.conf這里;
如果你用tar包安裝的apache,那麼應該在你apache安裝目錄下的conf/httpd.conf這里;
如果apache是在/usr/local/apache2安裝的,那麼主配置文件就在/usr/local/apache2/conf/httpd.conf這里.

5. linux apache 怎麼換埠

  1. 找到apache配置文件: /etc/httpd/conf/httpd.conf,找到apache目錄下的httpd.conf, 使用vi打開,找到port=80 這一行,把80改成在此伺服器上沒有用到的埠號

  2. 保存退出

  3. 重啟apache

6. 如何修改Linux系統下的Apache伺服器運行埠

Apache的埠號是在其目錄下的 httpd.conf這個文件中設置的。
Apache是跨平台的軟體,在linux/windows/unix下都有相應的版本。

找到apache目錄下的httpd.conf, 使用vi打開,找到port=80 這一行,把80改成在此伺服器上沒有用到的埠號,保存退出。

然後重新啟動apache進程即可。

如果你用rpm包安裝的apache,那麼你的主配置文件應該是在/etc/httpd/conf/httpd.conf這里;
如果你用tar包安裝的apache,那麼應該在你apache安裝目錄下的conf/httpd.conf這里;
如果apache是在/usr/local/apache2安裝的,那麼主配置文件就在/usr/local/apache2/conf/httpd.conf這里.

7. 如何更改linux下的Apache埠號

apache默認埠是80,當被佔用時就會關閉,可以把埠改為8090,然後重啟apache

8. 如何更改linux下的apache埠號

如何更改linux下的Apache埠號

一、修改
/etc/httpd/conf/httpd.conf
文件中的監聽埠號

Listen 80

80
修改成需要的號,如
8000
,即

Listen 8000
二、查看
SELinux

http
相關埠

# semanage port -l|grep http
http_cache_port_t tcp 3128, 8080, 8118, 10001-10010
http_cache_port_t udp 3130
http_port_t tcp 80, 443, 488, 8008, 8009, 8443
pegasus_http_port_t tcp 5988
pegasus_https_port_t tcp 5989
發現
8000
不在其范圍之內,所以需要另外添加,方法如下:

# semanage port -a -t http_port_t -p tcp 8000
再次查看,

# semanage port -l|grep http
http_cache_port_t tcp 3128, 8080, 8118, 10001-10010
http_cache_port_t udp 3130
http_port_t tcp 8000, 80, 443, 488, 8008, 8009, 8443
pegasus_http_port_t tcp 5988
pegasus_https_port_t tcp 5989
三、在防火牆中開放新添加的埠

修改
/etc/sysconfig/iptables
文件,在文件中添加如一行:

-A INPUT -m state --state NEW -m tcp -p tcp --dport 8008 -j ACCEPT

2

四、重啟防火牆和
Apache
# service iptables restart
# service httpd restart
五、正常情況下,應該可以通過新埠訪問
WEB
服務了。

註:

1
、第二、三、四步驟是在系統已經開啟
SELinux
和防火牆的情況下設置的,如果已經關閉此兩
個服務,修改埠後直接重啟
Apache
即可;

2
、修改的埠號可以是執行
#semanage port -l|grep http
後,默認已經有的埠,如
8443
,這樣
可以省略額外添加
SELinux
埠操作;

3
、第三步操作可以圖形界面下完成。

參考資料

1

Permission denied: make_sock: could not bind to address
http://emmune.blogspot.com/2009/07/permission-denied-makesock-could-not.html
不熟悉
python

plone

zope
,想用
apache

80
埠已經不在,就徵用
81
埠湊合吧。修改
httpd.conf

apachectl start
,結果:

(13)Permission denied: make_sock: could not bind to address [::]:81
(13)Permission denied: make_sock: could not bind to address 0.0.0.0:81

查一下
SELinux

http
相關埠
semanage port -l|grep http
,結果:

http_cache_port_t tcp 3128, 8080, 8118, 10001-10010
http_cache_port_t udp 3130
http_port_t tcp 80, 443, 488, 8008, 8009, 8443
pegasus_http_port_t tcp 5988
pegasus_https_port_t tcp 5989

直接用
man semanage
最後例子中的一句

# Allow Apache to listen on port 81
semanage port -a -t http_port_t -p tcp 81

3

然後再
apachectl start

OK
。使用域名
:81
能夠訪問啦。

註:
semanage

semanage is used to configure certain elements of SELinux policy without requiring modification
to or recompilation from policy sources. This includes the mapping from Linux usernames to
SELinux user identities (which controls the initial security context assigned to Linux users when
they login and bounds their authorized role set) as well as security context mappings for various
kinds of objects, such as network ports, interfaces, and nodes(hosts) as well as the file context
mapping. See the EXAMPLES section below for some examples of common usage. Note that
the semanage login command deals with the mapping from Linux usernames (logins) to
SELinux user identities, while the semanage user command deals with the mapping from
SELinux user identities to authorized role sets. In most cases, only the former mapping needs to
be adjusted by the administrator; the latter is principally defined by the base policy and usually
does not require modification.
2

linux

apche
無法監聽埠解決辦法

http://www.zzxj.net/blog/fxs_2008/archive/2010/07/05/187.html
想建立一個測試用的虛擬主機,遇到了這個問題:

[root@localhost html]# service httpd start
Starting httpd: httpd: Could not reliably determine the server's fully qualified domain name, using
localhost.termwikidev for ServerName
(13)Permission denied: make_sock: could not bind to address [::]:81
(13)Permission denied: make_sock: could not bind to address 0.0.0.0:81
no listening sockets available, shutting down
Unable to open logs

解決辦法:

semanage port -l|grep http
semanage port -a -t http_port_t -p tcp 81

這個兩個命令一是查看,一個是添加,添加完再查看一遍,如果有
81
,則成功。另可能要以
root
用戶運行。

此外,如果要外網訪問,還要打開
linux
的防火牆:

4

[root@localhost html]# vim /etc/sysconfig/iptables
[root@localhost html]# service iptables restart

重啟
apache.

相關資料:

starting httpd 13 permission denied make_sock could not bind to address2010

01

19



期二
11:33In Fedora Core 5/6 and RHEL 5. We have made it easier to customize certain
common parts of SELinux. In previous releases of SELinux if you wanted to change simple
things like which port a daemon could listen to, you would need to write policy. Now we have the
semanage utility.

SELinux assigns types to all network ports on a system. By default all ports are less then 1024
are labeled reserved_port_t and all ports > 1024 are labeled port_t. If a port is assigned to a
particular type
say the http port 80, it has an assigned type of http_port_t. If you want to look at all the assigned
ports in SELinux, you can use the semanage tool, semanage port -l.

So if you executed

semanage port -l | grep http
http_cache_port_t tcp 3128, 8080, 8118
http_cache_port_t udp 3130
http_port_t tcp 80, 443, 488, 8008, 8009, 8443
pegasus_http_port_t tcp 5988
pegasus_https_port_t tcp 5989

Here we see http_port_t is assigned to ports 80, 443, 488, 8008, 8009, 8443

The policy is written to allow httpd_t http_port_t:tcp_socket name_bind;

This means the apache command can "bind" to an port that is labeled http_port_t.
So lets say you want to run httpd on port 81.

So you edit /etc/httpd/http.conf

and change this line
Listen 80
to
Listen 81

Now restart the daemon.
service httpd restart
Stopping httpd: [ OK ]
Starting httpd: (13)Permission denied: make_sock: could not bind to address [::]:81
(13)Permission denied: make_sock: could not bind to address 0.0.0.0:81
no listening sockets available, shutting down
Unable to open logs
[FAILED]

Now the daemon fails to start because it can not bind to port 81.

This generates an AVC that looks like

----
time->Tue Dec 12 17:37:49 2006
type=SYSCALL msg=audit(1165963069.248:852): arch=40000003 syscall=102 success=no
exit=-13 a0=2 a1=bf96a830 a2=b5b1e8 a3=9e58b68 items=0 ppid=3 pid=4
auid=3267 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=pts10 comm="httpd"
exe="/usr/sbin/httpd" subj=user_u:system_r:httpd_t:s0 key=(null)
type=AVC msg=audit(1165963069.248:852): avc: denied { name_bind } for pid=4
comm="httpd" src=81 scontext=user_u:system_r:httpd_t:s0
tcontext=system_u:object_r:reserved_port_t:s0 tclass=tcp_socket

To fix this you can use semanage to add the port

semanage port -a -t http_port_t -p tcp 81

熱點內容
迅雷阻止上傳 發布:2024-05-05 21:26:19 瀏覽:912
資料庫運維題 發布:2024-05-05 21:21:47 瀏覽:960
RM魔塔編程 發布:2024-05-05 21:21:47 瀏覽:284
matlab獲取文件夾 發布:2024-05-05 21:12:24 瀏覽:290
一根式演算法 發布:2024-05-05 21:12:23 瀏覽:954
php無刷新 發布:2024-05-05 21:08:11 瀏覽:982
搭建一個流媒體伺服器 發布:2024-05-05 20:40:59 瀏覽:667
2017中超資料庫 發布:2024-05-05 20:37:25 瀏覽:379
編程包游戲 發布:2024-05-05 20:25:00 瀏覽:609
系統鎖屏忘記密碼如何設置 發布:2024-05-05 20:18:07 瀏覽:760