在虚拟主机上托管页面时发现 302,Ubuntu
302 Found while hosting page on virtualhost, Ubuntu
所以我正在尝试在 apache 上托管一个网页,ubuntu 平台使用虚拟主机概念。到目前为止,我做了这些更改。
在此路径上创建网页 /var/www/test/index。html
它的内容是:
$猫index.html
嘿这是一个测试网页
在此路径 /etc/apache2/sites-available/test.com.conf
上为虚拟主机创建了 .conf 文件
它的内容是:
<VirtualHost *:80>
ServerName test.com
ServerAlias www.test.com
ServerAdmin admin@test.com
DocumentRoot /var/www/test
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
- 运行 "sudo a2ensite test.com.conf" 启用它。
- 重启apache。
现在,当我尝试 curl test.com 时,我不知从哪里得到了这个奇怪的输出
输出:
$ curl test.com
<html>
<head><title>302 Found</title></head>
<body bgcolor="white">
<center><h1>302 Found</h1></center>
<hr><center>nginx/1.9.15</center>
</body>
</html>
我不明白这里发生了什么,这个网页是从哪里来的,我应该如何修复它才能获得我想要的网页。我没有在我的机器上安装 nginx。请帮忙。
将 test.com 指向 HOSTS 文件中的本地主机。那至少会让你 "test" 你的配置
所以我正在尝试在 apache 上托管一个网页,ubuntu 平台使用虚拟主机概念。到目前为止,我做了这些更改。
在此路径上创建网页 /var/www/test/index。html 它的内容是:
$猫index.html
嘿这是一个测试网页
在此路径 /etc/apache2/sites-available/test.com.conf
上为虚拟主机创建了 .conf 文件
它的内容是:
<VirtualHost *:80>
ServerName test.com
ServerAlias www.test.com
ServerAdmin admin@test.com
DocumentRoot /var/www/test
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
- 运行 "sudo a2ensite test.com.conf" 启用它。
- 重启apache。
现在,当我尝试 curl test.com 时,我不知从哪里得到了这个奇怪的输出
输出:
$ curl test.com
<html>
<head><title>302 Found</title></head>
<body bgcolor="white">
<center><h1>302 Found</h1></center>
<hr><center>nginx/1.9.15</center>
</body>
</html>
我不明白这里发生了什么,这个网页是从哪里来的,我应该如何修复它才能获得我想要的网页。我没有在我的机器上安装 nginx。请帮忙。
将 test.com 指向 HOSTS 文件中的本地主机。那至少会让你 "test" 你的配置