1、打開(kāi)Apache的配置文件httpd.conf,在Listen 80處另起一行輸入Listen 8080(監(jiān)聽(tīng)8080端口),要想再添加端口可依次添加
2、在httpd.conf文件最后一行添加:注:默認(rèn)的80路徑為/var/www/html/,我這是在這個(gè)下面的文件夾下添加test文件夾為測(cè)試
NameVirtualHost*:8080<VirtualHost*:8080>ServerNamelocalhost:8080DocumentRoot"/var/www/html/test/&PRime;
<Directory"/var/www/html/test/">
OptionsFollowSymLinksIncludesNOEXECAllowOverrideAllOrderDeny,AllowAllowfromall</Directory>
</VirtualHost>3、重啟Apache:# service iptables restart4、把8080(監(jiān)聽(tīng)的端口)開(kāi)放防火墻ok,就這么簡(jiǎn)單 大功告成----------------------------------------------------------------------------后面發(fā)現(xiàn)還有更方便的方法1、# cd /etc/httpd/conf.d/ 在這個(gè)文件夾下新建 .conf文件 --自己命名.conf寫(xiě)入內(nèi)容如下:
Listen 8080NameVirtualHost *:8080<VirtualHost *:8080> DocumentRoot /var/www/html/test ServerNamelocalhost:8080
AddDefaultCharset UTF-8
</VirtualHost>
然后保存 重啟httpd服務(wù),開(kāi)放端口防火墻就可以了。
新聞熱點(diǎn)
疑難解答
圖片精選