Skip to content

Instantly share code, notes, and snippets.

@jfloff
Last active February 13, 2025 01:03

Revisions

  1. jfloff revised this gist Mar 11, 2013. 1 changed file with 25 additions and 28 deletions.
    53 changes: 25 additions & 28 deletions mamp.md
    Original file line number Diff line number Diff line change
    @@ -1,21 +1,21 @@
    First of all you need to be able to run MAMP in port 80. This is a "heat check" if you don't have any process jamming http ports. You can check it like this:

    sudo lsof | grep LISTEN
    sudo lsof | grep LISTEN

    If you do happen to have any process with something like this `*:http (LISTEN)`, you are in trouble. Before with adventure check if it isn't MAMP itself (yeah, you should close that beforehand)

    ps <pid of that process>
    ps <pid of that process>

    If you don't see MAMP, you are in good hands, I have just the thing for you:

    # I've forced the removal of the job
    $ launchctl remove org.apache.httpd
    # and load it again
    $ launchctl load -w /System/Library/LaunchDaemons/org.apache.httpd.plist
    # and unload it again
    $ launchctl unload -w /System/Library/LaunchDaemons/org.apache.httpd.plist
    # I've forced the removal of the job
    $ launchctl remove org.apache.httpd

    # and load it again
    $ launchctl load -w /System/Library/LaunchDaemons/org.apache.httpd.plist

    # and unload it again
    $ launchctl unload -w /System/Library/LaunchDaemons/org.apache.httpd.plist

    Now you should be able to use port 80 (and almost any other) in MAMP. Just go to MAMP > Preferences > Ports Tab and click the _Set to default Apache and MySQL ports_.

    @@ -25,13 +25,13 @@ Now comes the easy part, you just have to follow what this guy wrote [here](http

    2. Generate a (dummy) SSL Certificate

    cd ~
    $ cd ~

    # generate a private key (will request a password twice)
    openssl genrsa -des3 -out server.key 1024
    $ openssl genrsa -des3 -out server.key 1024
    # generate certificate signing request (same password as above)
    openssl req -new -key server.key -out server.csr
    $ openssl req -new -key server.key -out server.csr
    # Answer the questions
    Country Name (2 letter code) [AU]: CA
    @@ -45,31 +45,28 @@ Now comes the easy part, you just have to follow what this guy wrote [here](http
    An optional company name []: # leave this empty
    # generate the certificate
    openssl x509 -req -days 365 -in server.csr -signkey server.key -out server.crt
    $ openssl x509 -req -days 365 -in server.csr -signkey server.key -out server.crt
    # remove the password from the server key
    cp server.key server.tmp
    openssl rsa -in server.tmp -out server.key
    $ cp server.key server.tmp
    $ openssl rsa -in server.tmp -out server.key
    # Move the certificate into your MAMP apache configuration folder
    cp server.crt /Applications/MAMP/conf/apache
    cp server.key /Applications/MAMP/conf/apache

    $ cp server.crt /Applications/MAMP/conf/apache
    $ cp server.key /Applications/MAMP/conf/apache

    3. Open /Applications/MAMP/conf/apache/httpd.conf and uncomment `Include /Applications/MAMP/conf/apache/extra/httpd-ssl.conf`.

    4. Keep your vhost in `/Applications/MAMP/conf/apache/extra/httpd-vhosts.conf` just the same.

    5. In `/Applications/MAMP/conf/apache/extra/httpd-ssl.conf`, find the following block and edit the fields *Server Name* and *Document Root* with the values you already have in your vhost.

    ```text
    # General setup for the virtual host
    DocumentRoot "/Applications/MAMP/Library/htdocs"
    ServerName www.example.com:443
    ServerAdmin [email protected]
    ErrorLog "/Applications/MAMP/Library/logs/error_log"
    TransferLog "/Applications/MAMP/Library/logs/access_log"
    and edit in your DocumentRoot and ServerName settings:
    ```
    # General setup for the virtual host
    DocumentRoot "/Applications/MAMP/Library/htdocs"
    ServerName www.example.com:443
    ServerAdmin [email protected]
    ErrorLog "/Applications/MAMP/Library/logs/error_log"
    TransferLog "/Applications/MAMP/Library/logs/access_log"
    and edit in your DocumentRoot and ServerName settings:

    ### Happy secure MAMPing!
  2. jfloff revised this gist Mar 11, 2013. 1 changed file with 32 additions and 40 deletions.
    72 changes: 32 additions & 40 deletions mamp.md
    Original file line number Diff line number Diff line change
    @@ -1,18 +1,13 @@
    First of all you need to be able to run MAMP in port 80. This is a "heat check" if you don't have any process jamming http ports. You can check it like this:

    ```console
    sudo lsof | grep LISTEN
    ```
    sudo lsof | grep LISTEN

    If you do happen to have any process with something like this `*:http (LISTEN)`, you are in trouble. Before with adventure check if it isn't MAMP itself (yeah, you should close that beforehand)

    ```console

    ps <pid of that process>
    ```


    If you don't see MAMP, you are in good hands, I have just the thing for you:

    ```console
    # I've forced the removal of the job
    $ launchctl remove org.apache.httpd

    @@ -21,7 +16,6 @@ If you don't see MAMP, you are in good hands, I have just the thing for you:

    # and unload it again
    $ launchctl unload -w /System/Library/LaunchDaemons/org.apache.httpd.plist
    ```

    Now you should be able to use port 80 (and almost any other) in MAMP. Just go to MAMP > Preferences > Ports Tab and click the _Set to default Apache and MySQL ports_.

    @@ -31,37 +25,35 @@ Now comes the easy part, you just have to follow what this guy wrote [here](http

    2. Generate a (dummy) SSL Certificate

    ```console
    cd ~
    # generate a private key (will request a password twice)
    openssl genrsa -des3 -out server.key 1024
    # generate certificate signing request (same password as above)
    openssl req -new -key server.key -out server.csr
    # Answer the questions
    Country Name (2 letter code) [AU]: CA
    State or Province Name (full name) [Some-State]: Quebec
    Locality Name (eg, city) []: Montreal
    Organization Name (eg, company) [Internet Widgits Pty Ltd]: Your Company
    Organizational Unit Name (eg, section) []: Development
    Common Name (eg, YOUR name) []: localhost
    Email Address []: [email protected]
    A challenge password []: # leave this empty
    An optional company name []: # leave this empty
    # generate the certificate
    openssl x509 -req -days 365 -in server.csr -signkey server.key -out server.crt
    # remove the password from the server key
    cp server.key server.tmp
    openssl rsa -in server.tmp -out server.key
    # Move the certificate into your MAMP apache configuration folder
    cp server.crt /Applications/MAMP/conf/apache
    cp server.key /Applications/MAMP/conf/apache
    ```
    cd ~

    # generate a private key (will request a password twice)
    openssl genrsa -des3 -out server.key 1024
    # generate certificate signing request (same password as above)
    openssl req -new -key server.key -out server.csr
    # Answer the questions
    Country Name (2 letter code) [AU]: CA
    State or Province Name (full name) [Some-State]: Quebec
    Locality Name (eg, city) []: Montreal
    Organization Name (eg, company) [Internet Widgits Pty Ltd]: Your Company
    Organizational Unit Name (eg, section) []: Development
    Common Name (eg, YOUR name) []: localhost
    Email Address []: [email protected]
    A challenge password []: # leave this empty
    An optional company name []: # leave this empty
    # generate the certificate
    openssl x509 -req -days 365 -in server.csr -signkey server.key -out server.crt
    # remove the password from the server key
    cp server.key server.tmp
    openssl rsa -in server.tmp -out server.key
    # Move the certificate into your MAMP apache configuration folder
    cp server.crt /Applications/MAMP/conf/apache
    cp server.key /Applications/MAMP/conf/apache


    3. Open /Applications/MAMP/conf/apache/httpd.conf and uncomment `Include /Applications/MAMP/conf/apache/extra/httpd-ssl.conf`.
  3. jfloff revised this gist Mar 11, 2013. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion mamp.md
    Original file line number Diff line number Diff line change
    @@ -1,7 +1,7 @@
    First of all you need to be able to run MAMP in port 80. This is a "heat check" if you don't have any process jamming http ports. You can check it like this:

    ```console
    sudo lsof | grep LISTEN
    sudo lsof | grep LISTEN
    ```

    If you do happen to have any process with something like this `*:http (LISTEN)`, you are in trouble. Before with adventure check if it isn't MAMP itself (yeah, you should close that beforehand)
  4. jfloff created this gist Mar 11, 2013.
    83 changes: 83 additions & 0 deletions mamp.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,83 @@
    First of all you need to be able to run MAMP in port 80. This is a "heat check" if you don't have any process jamming http ports. You can check it like this:

    ```console
    sudo lsof | grep LISTEN
    ```

    If you do happen to have any process with something like this `*:http (LISTEN)`, you are in trouble. Before with adventure check if it isn't MAMP itself (yeah, you should close that beforehand)

    ```console
    ps <pid of that process>
    ```

    If you don't see MAMP, you are in good hands, I have just the thing for you:

    ```console
    # I've forced the removal of the job
    $ launchctl remove org.apache.httpd

    # and load it again
    $ launchctl load -w /System/Library/LaunchDaemons/org.apache.httpd.plist

    # and unload it again
    $ launchctl unload -w /System/Library/LaunchDaemons/org.apache.httpd.plist
    ```

    Now you should be able to use port 80 (and almost any other) in MAMP. Just go to MAMP > Preferences > Ports Tab and click the _Set to default Apache and MySQL ports_.

    Now comes the easy part, you just have to follow what this guy wrote [here](http://soundsplausible.com/2012/01/14/enable-ssl-in-mamp-2-0-5/). Well, that's copy that here just in case ...

    1. Backup your `/Applications/MAMP/conf/` dir.

    2. Generate a (dummy) SSL Certificate

    ```console
    cd ~
    # generate a private key (will request a password twice)
    openssl genrsa -des3 -out server.key 1024
    # generate certificate signing request (same password as above)
    openssl req -new -key server.key -out server.csr
    # Answer the questions
    Country Name (2 letter code) [AU]: CA
    State or Province Name (full name) [Some-State]: Quebec
    Locality Name (eg, city) []: Montreal
    Organization Name (eg, company) [Internet Widgits Pty Ltd]: Your Company
    Organizational Unit Name (eg, section) []: Development
    Common Name (eg, YOUR name) []: localhost
    Email Address []: [email protected]
    A challenge password []: # leave this empty
    An optional company name []: # leave this empty
    # generate the certificate
    openssl x509 -req -days 365 -in server.csr -signkey server.key -out server.crt
    # remove the password from the server key
    cp server.key server.tmp
    openssl rsa -in server.tmp -out server.key
    # Move the certificate into your MAMP apache configuration folder
    cp server.crt /Applications/MAMP/conf/apache
    cp server.key /Applications/MAMP/conf/apache
    ```


    3. Open /Applications/MAMP/conf/apache/httpd.conf and uncomment `Include /Applications/MAMP/conf/apache/extra/httpd-ssl.conf`.

    4. Keep your vhost in `/Applications/MAMP/conf/apache/extra/httpd-vhosts.conf` just the same.

    5. In `/Applications/MAMP/conf/apache/extra/httpd-ssl.conf`, find the following block and edit the fields *Server Name* and *Document Root* with the values you already have in your vhost.

    ```text
    # General setup for the virtual host
    DocumentRoot "/Applications/MAMP/Library/htdocs"
    ServerName www.example.com:443
    ServerAdmin [email protected]
    ErrorLog "/Applications/MAMP/Library/logs/error_log"
    TransferLog "/Applications/MAMP/Library/logs/access_log"
    and edit in your DocumentRoot and ServerName settings:
    ```

    ### Happy secure MAMPing!