linux apache添加多站点配置(Ubuntn和Centos)
生活随笔
收集整理的這篇文章主要介紹了
linux apache添加多站点配置(Ubuntn和Centos)
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
?Linux Apache 多站點配置
?
Centos 配置方式:
找到 /etc/httpd/conf/http.conf
添加監聽端口,eg: Listen 89
虛擬機配置,一個端口對應一個
<VirtualHost *:89>DocumentRoot "文件目錄" ServerName ******ServerAlias<Directory "同上">Options FollowSymLinks ExecCGIAllowOverride AllOrder allow,denyAllow from allRequire 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@localhostDocumentRoot /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 warnCustomLog ${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
總結
以上是生活随笔為你收集整理的linux apache添加多站点配置(Ubuntn和Centos)的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: python里的坑。http://www
- 下一篇: struts 的 MVC ,自己堆栈跟踪