[英]Getting SSL to work in Xampp - Access forbidden error
我試圖讓Xampp在https中工作,但我遇到了一些問題。
到目前為止我做了什么:
我是否需要在httpd-ssl.conf中更改服務器名稱?
編輯:我需要在端口443和80上的httpd-vhosts.conf中添加虛擬主機嗎? 另外,Xampp是否附帶內置SSL證書等?
我認為最好的方法是為您正在開發的每個項目創建一個VirtualHost 。 否則,您需要更改當時正在開發的項目的DocumentRoot。
因此,您可以更改“httpd-vhosts.conf”文件並為端口80創建VH,將所有請求重定向到端口443的VH(如果您只想禁用HTTP),如下所示:
•HTTP
<VirtualHost *:80>
ServerName yoursite.your.domain
Redirect / https://yoursite.your.domain/
</VirtualHost>
•HTTPS
<VirtualHost *:443>
ServerName yoursite.your.domain:443
#in your case you're not using htdocs, so DocumentRoot be like
DocumentRoot "C:\xampp\yourproject"
<IfModule mod_headers.c>
Header set Access-Control-Allow-Origin "*"
Header always set Access-Control-Allow-Methods "POST, PUT, GET, DELETE, OPTIONS"
Header always set Access-Control-Allow-Headers "Content-Type"
</IfModule>
#the same here
<Directory "C:\xampp\yourproject">
Options +Indexes +Includes +FollowSymLinks +MultiViews
AllowOverride All
Require all granted
</Directory>
#check your absolute path bellow
SSLEngine on
SSLCertificateFile "C:\xampp\apache\conf\ssl.crt\server.crt"
SSLCertificateKeyFile "C:\xampp\apache\conf\ssl.key\server.key"
</VirtualHost>
關於證書,我認為XAMPP實際上帶有內置的SSL證書,但是,即使它沒有出現,你也可以使用他的工具生成它。 你可以在互聯網上看到很多這方面的教程 。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.