为什么';这不是Apache virtualhost的入门工作吗?
我在Ubuntu13上运行Apache2.4.6 在可用的站点中,我的站点有一个conf文件,其中只包含以下内容:为什么';这不是Apache virtualhost的入门工作吗?,apache,virtualhost,Apache,Virtualhost,我在Ubuntu13上运行Apache2.4.6 在可用的站点中,我的站点有一个conf文件,其中只包含以下内容: <VirtualHost *:80> # Admin email, Server Name (domain name), and any aliases ServerAdmin somebody@somewhere.com ServerName www.ourco.me ServerAlias ourco.me # Index file and
<VirtualHost *:80>
# Admin email, Server Name (domain name), and any aliases
ServerAdmin somebody@somewhere.com
ServerName www.ourco.me
ServerAlias ourco.me
# Index file and Document Root (where the public files are located)
DirectoryIndex index.html index.php
DocumentRoot /home/ouruser/public/ourco.me/public
# Log file locations
LogLevel warn
ErrorLog /home/ouruser/public/ourco.me/log/error.log
CustomLog /home/ouruser/public/ourco.me/log/access.log combined
</VirtualHost>
我注意到的第一件事是namevhost www.ourco.me的重复条目。当我在浏览器中访问网站时,我会得到:
您没有访问/访问此服务器的权限
Apache/2.4.6(Ubuntu)服务器,位于www.ourco.me端口80
conf文件中指定的所有目录和文件都存在。a2ensite和A2dispate按预期工作,从启用的站点添加/删除此文件的符号链接,因此它正在查看正确的文件。有人知道为什么它的指令被忽略了吗?谢谢。将允许从所有
Put Allow from all
<VirtualHost *:80>
# Admin email, Server Name (domain name), and any aliases
ServerAdmin somebody@somewhere.com
ServerName www.ourco.me
ServerAlias ourco.me
# Index file and Document Root (where the public files are located)
DirectoryIndex index.html index.php
DocumentRoot /home/ouruser/public/ourco.me/public
# Log file locations
LogLevel warn
ErrorLog /home/ouruser/public/ourco.me/log/error.log
CustomLog /home/ouruser/public/ourco.me/log/access.log combined
Allow from all
</VirtualHost>
#管理员电子邮件、服务器名(域名)和任何别名
服务器管理员somebody@somewhere.com
服务器名www.ourco.me
我们的公司
#索引文件和文档根目录(公共文件所在的位置)
DirectoryIndex.html index.php
DocumentRoot/home/ouruser/public/ourco.me/public
#日志文件位置
日志级别警告
ErrorLog/home/ouruser/public/ourco.me/log/error.log
CustomLog/home/ouruser/public/ourco.me/log/access.log组合
通融
这似乎解决了问题:
<Directory />
Require all granted
</Directory>
要求所有授权
当放置在VirtualHost条目中时
那个片段来自于。我正在查看它的工作原理。谢谢,但这不起作用。结果是:AH00526:etc/apache2/sites enabled/ourco.me.conf的第16行出现语法错误:此处不允许操作“configtest”失败。“Require all grated”似乎是新语法,也会失败,并显示类似消息。
<Directory />
Require all granted
</Directory>