Mamp Pro 4 HTTP and HTTPS

2019-04-13 01:25发布

问题:

Is it not possible in Mamp Pro 4 to have both http and https? The application I am working on requires both depending on the page.

I must be missing something as it makes no sense when I enable SSL only https works and http then stops working.

I tried going through the http.conf, but really have no idea whats causing this.

I think it just generates the vhost for https only and then removes http. Doesn't even look like you can manually edit it.

Any suggestion would be great.

回答1:

Well to update my own post and if anyone else has this problem.

The software is currently not capable of this on the same hostname.

According to Mamp support you have to create two hosts with the same name (e.g. sample.app and sample.app.).

  1. Enable one of the "sample.app" hostnames to use SSL
  2. Enable the second host entry "sample.app" to not use SSL. (Don't forget to hold Alt or Option when clicking on +)
  3. Point both to the same directory.

Mamp will highlight this in red, as its warning that you have two of the same hostnames.

So currently this is the only solution I am aware of for this issue.

Hope they resolve this in future updates as a lot of applications, especially ecommerce rely on the ability to switch between http and https.

You can see this on the Mamp Pro documentation here.



回答2:

I got a simple solution by edit template:

  1. Open Mamp Pro
  2. File > Edit Template > Apache > httpd-ssl.conf
  3. Add these line after

<VirtualHost *:80> ServerName MAMP_SSLVirtualHost_ServerName_MAMP MAMP_SSLVirtualHost_ServerAdmin_MAMP MAMP_SSLVirtualHost_DirectoryIndex_MAMP DocumentRoot MAMP_SSLVirtualHost_DocumentRoot_MAMP </VirtualHost>



标签: mamp mamp-pro