MAMP - Host name changes to first vhost SSL entry for project with two localhosts

Posted by user1322092 on Server Fault See other posts from Server Fault or by user1322092
Published on 2012-10-08T03:25:02Z Indexed on 2012/10/08 3:38 UTC
Read the original article Hit count: 577

Filed under:
|
|

I have two projects that are a copy of each other on my Mac with MAMP. They both have SSL pages. However, whenever I hit the a secured SSL page of project 2, the base_url or host changes to project1 instead of remaining project2. I know this is an issue with the vhosts, because if I switch the order of the entries, the reverse happens. Here's my config files:

    /Applications/MAMP/conf/extra/httpd-ssl.conf


<VirtualHost _default_:443>
DocumentRoot "/Applications/MAMP/htdocs/proj1"
ServerName proj1.localhost:443
ErrorLog "/Applications/MAMP/Library/logs/error_log"
TransferLog "/Applications/MAMP/Library/logs/access_log"
SSLEngine on
SSLCertificateFile "/Applications/MAMP/conf/apache/ssl/server.crt"
SSLCertificateKeyFile "/Applications/MAMP/conf/apache/ssl/server.key"
</VirtualHost> 

<VirtualHost _default_:443>
DocumentRoot "/Applications/MAMP/htdocs/proj2"
ServerName proj2.localhost:443
ErrorLog "/Applications/MAMP/Library/logs/error_log"
TransferLog "/Applications/MAMP/Library/logs/access_log"

SSLEngine on
SSLCertificateFile "/Applications/MAMP/conf/apache/ssl/server.crt"
SSLCertificateKeyFile "/Applications/MAMP/conf/apache/ssl/server.key"
</VirtualHost> 

--------------------
cat /etc/hosts

##
# Host Database
#
# localhost is used to configure the loopback interface
# when the system is booting.  Do not change this entry.
##
127.0.0.1   localhost
255.255.255.255 broadcasthost
::1             localhost 
fe80::1%lo0 localhost

127.0.0.1 proj1.localhost
127.0.0.1 proj2.localhost

© Server Fault or respective owner

Related posts about apache2

Related posts about virtualhost