简体   繁体   English

在 VPS 上设置 LAMP,虚拟主机不工作

[英]Setting up LAMP on VPS, virtual host not working

Trying to set up a sample site on a VPS with LAMP.尝试使用 LAMP 在 VPS 上设置示例站点。 Accessing the site via IP address loads it fine, but I'd like to make it work with the URL "mysite.dev".通过 IP 地址访问该站点可以正常加载,但我想让它与 URL “mysite.dev”一起使用。 However when I go to http://mysite.dev in Chrome, I get "This site can't be reached. mysite.dev refused to connect."但是,当我在 Chrome 中从 go 到http://mysite.dev时,我得到“无法访问此站点。mysite.dev 拒绝连接。”

I followed instructions from this article and the configtest is OK: https://linuxize.com/post/how-to-set-up-apache-virtual-hosts-on-ubuntu-20-04/我按照本文中的说明进行了配置测试,并且配置测试正常: https://linuxize.com/post/how-to-set-up-apache-virtual-hosts-on-ubuntu-20-04/

Port 80 is open.端口 80 已打开。

I did notice when I enter http://mysite.dev in Chrome, it replaces it with https and I can't get that to turn off.当我在 Chrome 中输入http://mysite.dev时,我确实注意到了,它用https替换它,我无法关闭它。 Not sure if that's the problem.不确定这是否是问题所在。

Here is the config setup:这是配置设置:

/etc/apache2/sites-available/mysite.dev.conf : /etc/apache2/sites-available/mysite.dev.conf

<VirtualHost *:80>
    ServerName mysite.dev
    ServerAlias www.mysite.dev
    ServerAdmin xxxx@gmail.com
    DocumentRoot /var/www/mysite.dev/public_html

    <Directory /var/www/mysite.dev/public_html>
        Options -Indexes +FollowSymLinks
        AllowOverride All
    </Directory>

    ErrorLog ${APACHE_LOG_DIR}/mysite.dev-error.log
    CustomLog ${APACHE_LOG_DIR}/mysite.dev-access.log combined
</VirtualHost>

My local /etc/hosts file:我的本地/etc/hosts文件:

123.123.123.123  mysite.dev
123.123.123.123  www.mysite.dev

Any help is appreciated.任何帮助表示赞赏。

Figured it out.弄清楚了。 Chrome forces all .dev domains to use HTTPS, which I hadn't configured. Chrome 强制所有.dev域使用我没有配置的 HTTPS。 Changed to use a different TLD and all is good.更改为使用不同的顶级域名,一切都很好。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM