【问题标题】:How to run different website in a same domain with HTTP and HTTPS如何使用 HTTP 和 HTTPS 在同一个域中运行不同的网站
【发布时间】:2018-04-17 13:47:54
【问题描述】:

我可以在同一个域中运行不同的网站吗?喜欢

http://www.example.com ----> in WordPress
https://example.com/ -----> in laravel

这里是参考网站

Website : www.linqs.in              
APP:    https://linqs.in/username

应用网址将通过提供的用户名打开用户的个人资料。

对不起,如果我弄错了!如果可能,请指导我。

【问题讨论】:

  • 你到底为什么要这么做?
  • @Mathew Daly 你检查过我在帖子中提到的参考网站吗?

标签: wordpress laravel http https dns


【解决方案1】:

您可以在virtual host configuration 中执行此操作:

Listen 80
Listen 443

<VirtualHost *:80>
    ServerName example.com
    DocumentRoot "/path/to/wordpress"
</VirtualHost>

<VirtualHost *:443>
    ServerName example.com
    DocumentRoot "/path/to/laravel/public"
</VirtualHost>

如果源不在您的默认 http 根目录下,您可能还需要定义目录。例如:

<VirtualHost *:443>
    ServerName example.com
    DocumentRoot "/path/to/laravel"
    <Directory /path/to/laravel>
          AllowOverride All
    </Directory>
</VirtualHost>

这也将允许 Apache 为该目录提供服务并使用任何 .htaccess 文件(如果之前不允许的话)。

【讨论】:

  • 我可以使用 'www.example.com' 和 'example.com' 而不是那样做吗?你有什么想法吗?
  • 您在每个配置中设置的服务器名称由您决定。网络服务器将响应该端口上请求特定服务器名称的请求。
【解决方案2】:

由于 URL 侦听端口如 http - 端口 80,https - 端口 443。因此,您可以通过 VirtualHost 配置确保同一域中的不同网站。

【讨论】:

猜你喜欢
  • 2018-11-16
  • 1970-01-01
  • 1970-01-01
  • 2019-03-06
  • 2012-07-11
  • 2018-05-08
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多