1

我刚刚开始使用 ubuntu 13.04,并且正在尝试在本地处理我网站的文件。

即使我已经使用我的项目的 url 创建了一个虚拟主机,并将 RewriteBase 修改为我的 htaccess 上的此路径。

我的问题是$_SERVER['DOCUMENT_ROOT'](它一直停留/var/www而不是/var/www/mysite)和相对路径..

谢谢您的帮助。

虚拟主机:ServerAdmin webmaster@localhost ServerName mysite.com

    DocumentRoot /var/www/mysite.com/public_html
    <Directory />
            Options FollowSymLinks
            AllowOverride None
    </Directory>
    <Directory /var/www>
            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

4

1 回答 1

2
 DocumentRoot /var/www/mysite
    <Directory />
            Options FollowSymLinks
            AllowOverride None
    </Directory>
    <Directory /var/www/mysite/>
            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

编辑配置后,在 ubuntu 终端中输入:

sudo a2dissite mysite && sudo a2ensite mysite

然后

sudo service apache2 restart

于 2013-07-05T13:32:06.380 回答