关闭

Ubuntu Apache多站点的配置

标签: apacheubuntuvim
1047人阅读 评论(0) 收藏 举报
分类:

大致步骤如下:

一.修改本机的hosts文件

        127.0.0.1            localhost
  127.0.0.1       www.bss360.com
  127.0.0.1       www.cmsdev.com

    1.    cd /etc

    2.    sudo vim hosts

    3.    添加上面两条信息(即可)

二.修改配置文件:

    1.    cd /etc/apache2/sites-enabled

    2.    sudo vim 000-default

    3.    添加下面新增部分(即可)


<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

    Alias /doc/ "/usr/share/doc/"
    <Directory "/usr/share/doc/">
        Options Indexes MultiViews FollowSymLinks
        AllowOverride None
        Order deny,allow
        Deny from all
        Allow from 127.0.0.0/255.0.0.0 ::1/128
    </Directory>

</VirtualHost>

#以下是新添的信息(可自行增加)

<VirtualHost *:80>
        ServerAdmin webmaster@localhost
        ServerName www.cmsdev.com
        DocumentRoot /var/www/myapp/
        <Directory />
                Options FollowSymLinks
                AllowOverride None
        </Directory>
        <Directory /var/www/>
                Options Indexes FollowSymLinks MultiViews
                AllowOverride None
                Order allow,deny
                allow from all
        </Directory>
</VirtualHost>

<VirtualHost *:80>
        ServerAdmin webmaster@localhost
        ServerName www.bss360.com
        DocumentRoot /var/www/bss360/web
        <Directory />
                Options FollowSymLinks
                AllowOverride None
        </Directory>
        <Directory /var/www/>
                Options Indexes FollowSymLinks MultiViews
                AllowOverride None
                Order allow,deny
                allow from all
        </Directory>
</VirtualHost>

三.重启apache,访问自己配置的站点

1.    sudo service apache2 restart

2.    直接访问   www.cmsdev.com   www.bss360.com














0
0

查看评论
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
    个人资料
    • 访问:126217次
    • 积分:2455
    • 等级:
    • 排名:第15096名
    • 原创:122篇
    • 转载:19篇
    • 译文:0篇
    • 评论:7条
    文章分类
    最新评论