linux apache添加多站点配置(Ubuntn和Centos)

 Linux Apache 多站点配置

 
Centos 配置方式:

找到 /etc/httpd/conf/http.conf

添加监听端口,eg: Listen 89

虚拟机配置,一个端口对应一个

<VirtualHost *:89>

    DocumentRoot "文件目录" 

    ServerName ******

    ServerAlias

  <Directory "同上">

      Options FollowSymLinks ExecCGI

      AllowOverride All

      Order allow,deny

      Allow from all

      Require all granted

  </Directory>

</VirtualHost> 

 

 保存退出。重启apache

systemctl restart httpd.service

Ubuntu配置方式:

ubuntu中安装的是apache2,没有http.conf文件。你找到/etc/apache2/中,发现有一个apache.conf。

在apache2.conf中只是找到一些在Include行,并没有相关设置。其实设置在/etc/apache2/sites-available/default中

找到/etc/apache2/sites-available/default,内容如下:

<VirtualHost *:80>
ServerAdmin webmaster@localhost

DocumentRoot /var/www
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /var/www/>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
</Directory>

ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
<Directory "/usr/lib/cgi-bin">
AllowOverride None
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny
Allow from all
</Directory>

ErrorLog ${APACHE_LOG_DIR}/error.log

# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn

CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
View Code

 

里面默认已添加一个80端口的,根据上面的配置,你添加另一个端口89

在找到/etc/apache2/ports.conf,添加一个监听的端口。

Listen 89

保存退出,重启Apache2即可。

service apache2 restart

 

转载于:https://www.cnblogs.com/makeup/p/5433837.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值