debian-apache2配置多个站点

时间:2022-10-05 21:22:26

1、进入到sites-available文件夹下,cd /etc/apache2/sites-available。

2、复制default,cp default site1。

3、修改site1内容,红字文字地方修改

<VirtualHost *:80>
        ServerAdmin webmaster@localhost

        DocumentRoot /var/www/site1


        <Directory /var/www/site1>
                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}/site1_error.log

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

        CustomLog ${APACHE_LOG_DIR}/site1_access.log combined
</VirtualHost>
4、建立软连接,
ln -s /etc/apache2/sites-available/site1 /etc/apache2/sites-enabled/site1