Skip to content

Instantly share code, notes, and snippets.

@kmassada
Forked from jimothyGator/README.md
Last active September 10, 2021 08:29
Show Gist options
  • Save kmassada/1ad1b0e1742139b8f3d5 to your computer and use it in GitHub Desktop.
Save kmassada/1ad1b0e1742139b8f3d5 to your computer and use it in GitHub Desktop.

Revisions

  1. kmassada revised this gist Nov 12, 2015. 2 changed files with 0 additions and 0 deletions.
    File renamed without changes.
    File renamed without changes.
  2. kmassada revised this gist Nov 7, 2015. No changes.
  3. kmassada revised this gist Nov 7, 2015. 1 changed file with 16 additions and 3 deletions.
    19 changes: 16 additions & 3 deletions README.md
    Original file line number Diff line number Diff line change
    @@ -6,16 +6,29 @@ File locations:
    * `default` and `default-ssl` to `/usr/local/etc/nginx/sites-available`

    ```
    #STOP APACHE
    sudo apachectl stop
    #REPLACE PORTS
    sudo sed -i 's/8080/80g' /usr/local/etc/nginx/nginx.conf
    mkdir -p /usr/local/etc/nginx/sites-available
    wget https://gist.github.com/kmassada/1ad1b0e1742139b8f3d5/raw/8f6edee0b3c488a057cdf084906f825810a19b57/default -O /usr/local/etc/nginx/sites-available/default
    wget https://gist.github.com/kmassada/1ad1b0e1742139b8f3d5/raw/8f6edee0b3c488a057cdf084906f825810a19b57/default-ssl -O /usr/local/etc/nginx/sites-available/default-ssl
    wget https://gist.github.com/kmassada/1ad1b0e1742139b8f3d5/raw/47763109f40a44a1baf43926c709bff83e9cee94/default -O /usr/local/etc/nginx/sites-available/default
    wget https://gist.github.com/kmassada/1ad1b0e1742139b8f3d5/raw/47763109f40a44a1baf43926c709bff83e9cee94/default-ssl -O /usr/local/etc/nginx/sites-available/default-ssl
    sudo -s nginx
    sudo nginx
    #SETUP PROJECTS
    mkdir ~/Sites
    sudo mkdir -p /var/ && sudo ln -s ~/Sites /var/www
    SITE="test.com"
    mkdir -p ~/Sites/$SITE
    echo '<html><body><h2>'${SITE}'</h2></body></html>' >> ~/Sites/$SITE/index.html
    yes|cp -f /usr/local/etc/nginx/sites-available/default /usr/local/etc/nginx/servers/$SITE
    sed -i "s/localhost/$SITE.build/g" /usr/local/etc/nginx/servers/$SITE
    sed -i "s/root_path/\/var\/www\/$SITE/g" /usr/local/etc/nginx/servers/$SITE
    sudo nginx -s reload
    ```
  4. kmassada revised this gist Nov 7, 2015. 3 changed files with 18 additions and 4 deletions.
    18 changes: 16 additions & 2 deletions README.md
    Original file line number Diff line number Diff line change
    @@ -1,7 +1,21 @@
    mkdir -p /usr/local/etc/nginx/sites-{enabled,available}
    mkdir -p /usr/local/etc/nginx/sites-available

    File locations:

    * `nginx.conf` to `/usr/local/etc/nginx/`
    * `default` and `default-ssl` to `/usr/local/etc/nginx/sites-available`
    * `homebrew.mxcl.nginx.plist` to `/Library/LaunchDaemons/`

    ```
    #REPLACE PORTS
    sudo sed -i 's/8080/80g' /usr/local/etc/nginx/nginx.conf
    mkdir -p /usr/local/etc/nginx/sites-available
    wget https://gist.github.com/kmassada/1ad1b0e1742139b8f3d5/raw/8f6edee0b3c488a057cdf084906f825810a19b57/default -O /usr/local/etc/nginx/sites-available/default
    wget https://gist.github.com/kmassada/1ad1b0e1742139b8f3d5/raw/8f6edee0b3c488a057cdf084906f825810a19b57/default-ssl -O /usr/local/etc/nginx/sites-available/default-ssl
    sudo -s nginx
    #SETUP PROJECTS
    mkdir ~/Sites
    sudo mkdir -p /var/ && sudo ln -s ~/Sites /var/www
    ```
    2 changes: 1 addition & 1 deletion default
    Original file line number Diff line number Diff line change
    @@ -5,7 +5,7 @@ server {
    #access_log logs/host.access.log main;

    location / {
    root html;
    root root_path;
    index index.html index.htm;
    }

    2 changes: 1 addition & 1 deletion default-ssl
    Original file line number Diff line number Diff line change
    @@ -13,7 +13,7 @@ server {
    ssl_prefer_server_ciphers on;

    location / {
    root html;
    root root_path;
    index index.html index.htm;
    }
    }
  5. kmassada revised this gist Nov 7, 2015. 2 changed files with 0 additions and 52 deletions.
    20 changes: 0 additions & 20 deletions homebrew.mxcl.nginx.plist
    Original file line number Diff line number Diff line change
    @@ -1,20 +0,0 @@
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
    <plist version="1.0">
    <dict>
    <key>Label</key>
    <string>homebrew.mxcl.nginx</string>
    <key>RunAtLoad</key>
    <true/>
    <key>KeepAlive</key>
    <false/>
    <key>ProgramArguments</key>
    <array>
    <string>/usr/local/opt/nginx/sbin/nginx</string>
    <string>-g</string>
    <string>daemon off;</string>
    </array>
    <key>WorkingDirectory</key>
    <string>/usr/local</string>
    </dict>
    </plist>
    32 changes: 0 additions & 32 deletions nginx.conf
    Original file line number Diff line number Diff line change
    @@ -1,32 +0,0 @@
    #user nobody;
    worker_processes 1;

    error_log /Library/Logs/nginx/error.log;

    events {
    worker_connections 1024;
    }

    http {
    include mime.types;
    default_type application/octet-stream;

    log_format main '$remote_addr - $remote_user [$time_local] "$request" '
    '$status $body_bytes_sent "$http_referer" '
    '"$http_user_agent" "$http_x_forwarded_for"';

    access_log /Library/Logs/nginx/access.log main;

    sendfile on;

    keepalive_timeout 65;

    index index.html index.php;

    upstream www-upstream-pool{
    server unix:/tmp/php-fpm.sock;
    }

    include /etc/nginx/conf.d/*.conf;
    include /usr/local/etc/nginx/sites-enabled/*;
    }
  6. @jimothyGator jimothyGator revised this gist Apr 22, 2013. No changes.
  7. @jimothyGator jimothyGator revised this gist Apr 22, 2013. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions default-ssl
    Original file line number Diff line number Diff line change
    @@ -3,8 +3,8 @@ server {
    server_name localhost;

    ssl on;
    ssl_certificate cert.pem;
    ssl_certificate_key cert.key;
    ssl_certificate server.crt;
    ssl_certificate_key server.key;

    ssl_session_timeout 5m;

  8. @jimothyGator jimothyGator revised this gist Apr 22, 2013. 2 changed files with 25 additions and 1 deletion.
    6 changes: 5 additions & 1 deletion README.md
    Original file line number Diff line number Diff line change
    @@ -1,3 +1,7 @@
    mkdir -p /usr/local/etc/nginx/sites-{enabled,available}

    Save `nginx.conf` to `/usr/local/etc/nginx/nginx.conf`, and `default` and `default-ssl` to `/usr/local/etc/nginx/sites-available`.
    File locations:

    * `nginx.conf` to `/usr/local/etc/nginx/`
    * `default` and `default-ssl` to `/usr/local/etc/nginx/sites-available`
    * `homebrew.mxcl.nginx.plist` to `/Library/LaunchDaemons/`
    20 changes: 20 additions & 0 deletions homebrew.mxcl.nginx.plist
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,20 @@
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
    <plist version="1.0">
    <dict>
    <key>Label</key>
    <string>homebrew.mxcl.nginx</string>
    <key>RunAtLoad</key>
    <true/>
    <key>KeepAlive</key>
    <false/>
    <key>ProgramArguments</key>
    <array>
    <string>/usr/local/opt/nginx/sbin/nginx</string>
    <string>-g</string>
    <string>daemon off;</string>
    </array>
    <key>WorkingDirectory</key>
    <string>/usr/local</string>
    </dict>
    </plist>
  9. @jimothyGator jimothyGator revised this gist Apr 22, 2013. 2 changed files with 34 additions and 7 deletions.
    22 changes: 15 additions & 7 deletions default
    Original file line number Diff line number Diff line change
    @@ -1,12 +1,20 @@
    server {
    listen 80 default_server;
    listen 80;
    server_name localhost;

    server_name _;
    #access_log logs/host.access.log main;

    location / {
    proxy_set_header Host $host;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $remote_addr;
    proxy_pass http://127.0.0.1:8000;
    root html;
    index index.html index.htm;
    }
    }

    #error_page 404 /404.html;

    # redirect server error pages to the static page /50x.html
    #
    error_page 500 502 503 504 /50x.html;
    location = /50x.html {
    root html;
    }
    }
    19 changes: 19 additions & 0 deletions default-ssl
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,19 @@
    server {
    listen 443;
    server_name localhost;

    ssl on;
    ssl_certificate cert.pem;
    ssl_certificate_key cert.key;

    ssl_session_timeout 5m;

    ssl_protocols SSLv2 SSLv3 TLSv1;
    ssl_ciphers HIGH:!aNULL:!MD5;
    ssl_prefer_server_ciphers on;

    location / {
    root html;
    index index.html index.htm;
    }
    }
  10. @jimothyGator jimothyGator revised this gist Apr 22, 2013. 1 changed file with 3 additions and 0 deletions.
    3 changes: 3 additions & 0 deletions README.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,3 @@
    mkdir -p /usr/local/etc/nginx/sites-{enabled,available}

    Save `nginx.conf` to `/usr/local/etc/nginx/nginx.conf`, and `default` and `default-ssl` to `/usr/local/etc/nginx/sites-available`.
  11. @jimothyGator jimothyGator revised this gist Apr 22, 2013. 1 changed file with 12 additions and 0 deletions.
    12 changes: 12 additions & 0 deletions default
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,12 @@
    server {
    listen 80 default_server;

    server_name _;

    location / {
    proxy_set_header Host $host;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $remote_addr;
    proxy_pass http://127.0.0.1:8000;
    }
    }
  12. @jimothyGator jimothyGator created this gist Apr 22, 2013.
    32 changes: 32 additions & 0 deletions nginx.conf
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,32 @@
    #user nobody;
    worker_processes 1;

    error_log /Library/Logs/nginx/error.log;

    events {
    worker_connections 1024;
    }

    http {
    include mime.types;
    default_type application/octet-stream;

    log_format main '$remote_addr - $remote_user [$time_local] "$request" '
    '$status $body_bytes_sent "$http_referer" '
    '"$http_user_agent" "$http_x_forwarded_for"';

    access_log /Library/Logs/nginx/access.log main;

    sendfile on;

    keepalive_timeout 65;

    index index.html index.php;

    upstream www-upstream-pool{
    server unix:/tmp/php-fpm.sock;
    }

    include /etc/nginx/conf.d/*.conf;
    include /usr/local/etc/nginx/sites-enabled/*;
    }