安装HTTPS对本地主机通配符子域

编程入门 行业动态 更新时间:2024-10-26 04:22:09
本文介绍了安装HTTPS对本地主机通配符子域的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我建立了我的本地的Ubuntu机 Laravel 应用程序。但我想用 HTTPS 在所有的外卡子域。我怎样才能做到这一点在当地?顺便说一句,我已经添加了我的网站的网址在 etc / hosts中所以我并不需要键入本地主机但而不是 www.mysite.loc 。

I have created a Laravel application on my local Ubuntu machine. But I want to use HTTPS on all of its wild card sub-domains. How can I do this locally? By the way, I have added my site URL on etc/hosts so I don't need to type localhost but instead www.mysite.loc.

在回答这个问题的如何在Ubuntu上安装本地主机的SSL。 ?,我觉得只能在主域名。

Answer in this question How to install SSL on localhost in ubuntu..?, I think will only work on the main domain.

推荐答案

没有,这个问题的如何在本地主机在Ubuntu ..?工作正常安装SSL。但是,你需要修改code几行字在你的 CONF 文件。

No, the answer with this question How to install SSL on localhost in ubuntu..? is working fine. But you need to modify few lines of code in your conf file.

我现在管理要尝试一下,工作正常,但我得到这个恼人的消息从我的网站,我访问不安全的浏览器。虽然这没关系,因为它仅仅是自签名证书。

I manage to try it now and works fine but I got this irritating message from my browser that the site I am accessing is not secure. Though it's okay, since it is just self signed certificate.

在我的 / etc / hosts中我增加了我的本地站点的多个子领域,因为它不会工作,即使你正确地配置您的虚拟主机,因为该网站的发展是不但在线访问。

In my /etc/hosts I added several sub domains for my local site since it will not work even you configured your virtual host properly because the site your developing is not yet accessible online.

说, www.mydomain , hello.mydomain ,世界.mydomain

现在,我们需要启用SSL模块

Now, we need to enable SSL module

须藤a2enmod SSL

重启Apache

须藤服务的Apache2重启

创建一个文件夹的自签名SSL证书

Create a folder for Self-signed SSL Certificates

须藤的mkdir在/ etc / apache2的/ SSL

生成密钥和其他东西的SSL

Generate key and other stuffs for SSL

须藤OpenSSL的REQ -x509 -nodes -days 365 -newkey RSA:2048 -keyout /etc/apache2/ssl/apache.key退房手续/etc/apache2/ssl/apache.crt

回答问题的,并使用您的域名称 mydomain 为通用名称

Answer questions their and use your domain say mydomain as Common name

现在我编辑了 CONF 我将驻留在 /etc/apache2/sites-available/mydomain.conf

Now I edited the conf file of my virtual host which resides in /etc/apache2/sites-available/mydomain.conf

这是里面有什么

<IfModule mod_ssl.c> <VirtualHost _default_:443> ServerAdmin admin@example ServerName www.mydomain ServerAlias mydomain *.mydomain DocumentRoot /home/me/projects/www/mysite_folder ErrorLog ${APACHE_LOG_DIR}/error.log CustomLog ${APACHE_LOG_DIR}/access.log combined SSLEngine on SSLCertificateFile /etc/apache2/ssl/apache.crt SSLCertificateKeyFile /etc/apache2/ssl/apache.key <FilesMatch "\.(cgi|shtml|phtml|php)$"> SSLOptions +StdEnvVars </FilesMatch> <Directory "/home/me/projects/www/mysite_folder"> SSLOptions +StdEnvVars Order allow,deny Allow from all # New directive needed in Apache 2.4.3: Require all granted AllowOverride All </Directory> BrowserMatch "MSIE [2-6]" \ nokeepalive ssl-unclean-shutdown \ downgrade-1.0 force-response-1.0 BrowserMatch "MSIE [17-9]" ssl-unclean-shutdown </VirtualHost>

如果您已经启用的虚拟主机,你需要跳过此步骤。否则,键入

If you already enable your virtual host, you need to skip this step. Else, type

须藤a2ensite mydomain.conf

最后,您需要再次重新启动Apache通过

Lastly, you need to restart Apache again by

须藤服务的Apache2重启

希望它可以帮助你!现在,您可以通过访问您的站点 HTTPS

Hope it helps you! You can now access your site using https

例。 www.mydomain , hello.mydomain , world.mydomain

更多推荐

安装HTTPS对本地主机通配符子域

本文发布于:2023-10-30 03:34:16,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1541645.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:通配符   主机   HTTPS

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!