国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 網(wǎng)站 > 建站經(jīng)驗 > 正文

CentOS系統(tǒng)下Apache配置多域名或多端口映射的方法

2019-11-02 16:44:56
字體:
供稿:網(wǎng)友

前提

CentOS下Apache默認網(wǎng)站根目錄為/var/www/html,假如我默認存了一個CI項目在html文件夾里,同時服務(wù)器的外網(wǎng)IP為ExampleIp,因為使用的是MVC框架,Apache需開啟重定向功能。

方法如下

/etc/httpd/conf/httpd.conf文件配置如下:

DocumentRoot "/var/www/html/CI"
<Directory /> Options FollowSymLinks AllowOverride All</Directory>
<Directory "/var/www/html/CI">## Possible values for the Options directive are "None", "All",# or any combination of:# Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews## Note that "MultiViews" must be named *explicitly* --- "Options All"# doesn't give it to you.## The Options directive is both complicated and important. Please see# http://httpd.apache.org/docs/2.2/mod/core.html#options# for more information.# Options Indexes FollowSymLinks## AllowOverride controls what directives may be placed in .htaccess files.# It can be "All", "None", or any combination of the keywords:# Options FileInfo AuthConfig Limit# AllowOverride All## Controls who can get stuff from this server.# Order allow,deny Allow from all</Directory>

配置完使用“service httpd restart”重啟Apache,那么直接在瀏覽器里輸入http://ExampleIp,就直接映射到/var/www/html/CI文件夾里了

1、配置多域名映射。假設(shè)需要映射www.website1.com和www.website1.com這兩個域名,在文檔httpd.conf最后添加

NameVirtualHost *:80<VirtualHost *:80>DocumentRoot /var/www/html/website1ServerName http://www.website1.com </Virtualhost><Directory "/var/www/html/website1"> Options Indexes FollowSymLinks AllowOverride All Order allow,deny Allow from all</Directory><VirtualHost *:80>DocumentRoot /var/www/html/website1ServerName http://website1.com </Virtualhost><Directory "/var/www/html/website1">Options Indexes FollowSymLinksAllowOverride AllOrder allow,denyAllow from all</Directory><VirtualHost *:80>DocumentRoot /var/www/html/website2ServerName http://www.website2.com </Virtualhost><Directory "/var/www/html/website2"> Options Indexes FollowSymLinks AllowOverride All Order allow,deny Allow from all</Directory><VirtualHost *:80>DocumentRoot /var/www/html/website2ServerName http://website2.com </Virtualhost><Directory "/var/www/html/website2">Options Indexes FollowSymLinksAllowOverride AllOrder allow,denyAllow from all</Directory>

website1和website2為工程目錄.配置完使用“service httpd restart”重啟Apache

2、配置多端口映射。

2.2、首先需要監(jiān)聽端口,在文檔httpd.conf的Listen 80下添加需要監(jiān)聽的端口,舉例為8080

Listen 80Listen 8080

2.2、在文檔最后添加端口映射功能

<VirtualHost ExampleIp:8080> DocumentRoot /var/www/html/website3 ServerName ExampleIp:8080</VirtualHost><Directory "/var/www/html/website3"> Options Indexes FollowSymLinks AllowOverride All Order allow,deny Allow from all</Directory>
發(fā)表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發(fā)表
主站蜘蛛池模板: 额尔古纳市| 丹凤县| 大兴区| 科技| 峨眉山市| 喀喇沁旗| 东城区| 门源| 湘乡市| 常熟市| 资阳市| 云梦县| 平顺县| 龙南县| 会泽县| 榆中县| 波密县| 渝北区| 东方市| 哈尔滨市| 黄平县| 金华市| 苏尼特左旗| 大渡口区| 太仆寺旗| 景泰县| 眉山市| 华阴市| 囊谦县| 寿阳县| 肇东市| 鄱阳县| 长泰县| 淄博市| 岑溪市| 象山县| 璧山县| 通渭县| 襄垣县| 友谊县| 蓬莱市|