在Amazon Web Service的ServerName
中声明VirtualHost
。我正在定义
<VirtualHost *:80>
DocumentRoot "/opt/bitnami/projects/fortis_django"
ServerName ec2-122-248-220-105.ap-southeast-1.compute.amazonaws.com/fortis
</VirtualHost>
<VirtualHost *:80>
DocumentRoot "/opt/bitnami/projects/myfood"
ServerName ec2-122-248-220-105.ap-southeast-1.compute.amazonaws.com/myfood
</VirtualHost>
也尝试了
<VirtualHost *:80>
DocumentRoot "/opt/bitnami/projects/fortis_django"
ServerName localhost/fortis
</VirtualHost>
<VirtualHost *:80>
DocumentRoot "/opt/bitnami/projects/myfood"
ServerName localhost/fortis
</VirtualHost>
重启Apache后出现错误
httpd:无法使用127.0.0.1 for ServerName
确定服务器的完全限定域
名称ServerName
默认情况下会ServerName localhost:80
我发表评论。
答案 0 :(得分:1)
ServerName
采用完全限定的域名,可选择一个端口,但不是您正在执行的路径。正确的值可以是例如:
ServerName ec2-122-248-220-105.ap-southeast-1.compute.amazonaws.com:80
或
ServerName localhost:80
答案 1 :(得分:0)
您可以尝试这样的事情:
<VirtualHost *:80>
ServerName fortis.com
DocumentRoot "/opt/bitnami/projects/fortis_django"
</VirtualHost>
<VirtualHost *:80>
ServerName myfood.com
DocumentRoot "/opt/bitnami/projects/myfood"
</VirtualHost>
'fortis.com'和'myfood.com'您真正的域名。 根据此名称,apache将选择文档根目录
祝你好运!