【发布时间】:2013-10-31 09:13:54
【问题描述】:
我有以下问题
我的hosts文件如下:
127.0.0.1 localhost
127.0.1.1 barbala4o-HP-ProBook-4530s
127.0.1.1 mysite.localhost
我在/etc/apache2/sites-available/mysite.localhost.conf的文件如下:
<VirtualHost *:80>
ServerAdmin webmaster@localhost
ServerName mysite.localhost
DocumentRoot /var/www/mysite
<Directory /var/www/mysite/>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
ErrorLog /var/log/apache2/mysite-error.log
CustomLog /var/log/apache2/mysite-access.log common
</VirtualHost>
在执行sudo a2ensite mysite.localhost.conf 并在 mysite.localhost/ 上重新启动 apache 之后,仅在 localhost 上我得到以下信息(比如列出一个没有索引文件的目录):
Index of /
[ICO] Name Last modified Size Description
[DIR] apache_logs/ 2013-09-24 10:15 -
[DIR] mysql/ 2013-10-22 10:05 -
[DIR] tools/ 2013-10-22 10:05
当我输入localhost/test 而不是加载它显示的index.php 文件时,在/var/www/ 目录中的任何其他文件夹(如测试)上:
Not Found
The requested URL /adlantic was not found on this server.
Apache/2.4.6 (Ubuntu) Server at localhost Port 80
如果我执行sudo a2dissite mysite.conf 并重新启动 apache,一切正常。我想问题出在mysite.localhost.conf 的某个地方,但我找不到在哪里。有任何想法吗? 10 倍
【问题讨论】:
-
您检查过
.../site-enabled/中的符号链接并确保它们是正确的吗? -
是的。我对 mysite.localhost.cong 文件进行了一些尝试,我得到了它的工作(或多或少),但现在 /var/www 中的其他文件夹如果它们无法访问不在本地主机上,他们给了我喜欢加载 index.php 的 localhost/test,它给了我 404 not found.The current versionof mysite.localhost.conf is:
ServerAdmin webmaster@example.com ServerName mysite .localhost ServerAlias mysite.localhost # 索引 + 目录根。 DirectoryIndex index.php DocumentRoot /var/www/mysite/public_html
标签: apache apache-config ubuntu-13.10