Skip to content

Instantly share code, notes, and snippets.

@1v
Last active May 31, 2018 16:45
Show Gist options
  • Select an option

  • Save 1v/7473b4acbaac0d79877d to your computer and use it in GitHub Desktop.

Select an option

Save 1v/7473b4acbaac0d79877d to your computer and use it in GitHub Desktop.

Revisions

  1. 1v revised this gist Jul 11, 2014. 1 changed file with 2 additions and 1 deletion.
    3 changes: 2 additions & 1 deletion gistfile1.md
    Original file line number Diff line number Diff line change
    @@ -59,4 +59,5 @@ Than run app just with upstream. [See](https://gist.github.com/1v/77595e676132a6
    * [`Ruby on Rails installation on Ubuntu 12.04 LTS + Nginx + Puma`](https://gist.github.com/1v/10272479)
    * [`Ruby on Rails "Hellow World" app`](https://gist.github.com/1v/a38f247c41ca60f6e48a)
    * [`Making production on port 80 and development on any other`](https://gist.github.com/1v/77595e676132a660843c)
    * [`Nginx behind Apache`](https://gist.github.com/1v/7473b4acbaac0d79877d)
    * [`Nginx behind Apache`](https://gist.github.com/1v/7473b4acbaac0d79877d)
    * [`God and Puma configuration`](https://gist.github.com/1v/04901ed17202cddfe42d)
  2. 1v revised this gist Jul 11, 2014. 1 changed file with 4 additions and 0 deletions.
    4 changes: 4 additions & 0 deletions gistfile1.md
    Original file line number Diff line number Diff line change
    @@ -1,5 +1,9 @@
    # Nginx **behind** Apache

    [Install](http://askubuntu.com/a/58185/160368) mod_proxy_http:
    ```
    a2enmod proxy_http
    ```
    Add to `/etc/apache2/apache2.conf` (change ip):
    ```
    <VirtualHost 11.1.11.111:80 >
  3. 1v revised this gist Jul 11, 2014. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion gistfile1.md
    Original file line number Diff line number Diff line change
    @@ -40,7 +40,7 @@ server {
    listen *:8080;
    server_name site.com;
    ```
    In `/etc/nginx/conf.d/default.conf` change port from 80 to something else:
    In `/etc/nginx/conf.d/default.conf` [change port](http://stackoverflow.com/a/12800469/712308) from 80 to something else:
    ```
    server {
    listen 3000;
  4. 1v revised this gist Jul 11, 2014. 1 changed file with 5 additions and 0 deletions.
    5 changes: 5 additions & 0 deletions gistfile1.md
    Original file line number Diff line number Diff line change
    @@ -40,6 +40,11 @@ server {
    listen *:8080;
    server_name site.com;
    ```
    In `/etc/nginx/conf.d/default.conf` change port from 80 to something else:
    ```
    server {
    listen 3000;
    ```
    Restart nginx:
    ```
    sudo service nginx restart
  5. 1v revised this gist Jul 11, 2014. 1 changed file with 7 additions and 1 deletion.
    8 changes: 7 additions & 1 deletion gistfile1.md
    Original file line number Diff line number Diff line change
    @@ -44,4 +44,10 @@ Restart nginx:
    ```
    sudo service nginx restart
    ```
    Than run app just with upstream. [See](https://gist.github.com/1v/77595e676132a660843c).
    Than run app just with upstream. [See](https://gist.github.com/1v/77595e676132a660843c).

    ## See also
    * [`Ruby on Rails installation on Ubuntu 12.04 LTS + Nginx + Puma`](https://gist.github.com/1v/10272479)
    * [`Ruby on Rails "Hellow World" app`](https://gist.github.com/1v/a38f247c41ca60f6e48a)
    * [`Making production on port 80 and development on any other`](https://gist.github.com/1v/77595e676132a660843c)
    * [`Nginx behind Apache`](https://gist.github.com/1v/7473b4acbaac0d79877d)
  6. 1v revised this gist Jul 11, 2014. 1 changed file with 3 additions and 3 deletions.
    6 changes: 3 additions & 3 deletions gistfile1.md
    Original file line number Diff line number Diff line change
    @@ -4,11 +4,11 @@ Add to `/etc/apache2/apache2.conf` (change ip):
    ```
    <VirtualHost 11.1.11.111:80 >
    ServerName site.com
    ServerAlias *.site.com
    ServerAlias *.site.com
    CustomLog /var/www/httpd-logs/site.com.access.log combined
    ErrorLog /var/www/httpd-logs/site.com.error.log
    ProxyPass / http://localhost:8080/
    ProxyPassReverse / http://localhost:8080/
    ProxyPass / http://localhost:8080/
    ProxyPassReverse / http://localhost:8080/
    ServerAdmin webmaster@site.com
    SuexecUserGroup user user
    </VirtualHost>
  7. 1v revised this gist Jul 11, 2014. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion gistfile1.md
    Original file line number Diff line number Diff line change
    @@ -1,6 +1,6 @@
    # Nginx **behind** Apache

    Add to `/etc/apache2/apache2.conf`:
    Add to `/etc/apache2/apache2.conf` (change ip):
    ```
    <VirtualHost 11.1.11.111:80 >
    ServerName site.com
  8. 1v created this gist Jul 11, 2014.
    47 changes: 47 additions & 0 deletions gistfile1.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,47 @@
    # Nginx **behind** Apache

    Add to `/etc/apache2/apache2.conf`:
    ```
    <VirtualHost 11.1.11.111:80 >
    ServerName site.com
    ServerAlias *.site.com
    CustomLog /var/www/httpd-logs/site.com.access.log combined
    ErrorLog /var/www/httpd-logs/site.com.error.log
    ProxyPass / http://localhost:8080/
    ProxyPassReverse / http://localhost:8080/
    ServerAdmin webmaster@site.com
    SuexecUserGroup user user
    </VirtualHost>
    ```
    [Add to](http://stackoverflow.com/a/719845/712308) `/etc/apache2/mods-available/proxy.conf`:
    ```
    <IfModule mod_proxy.c>
    ProxyRequests Off
    <Proxy *>
    Order deny,allow
    Allow from all
    </Proxy>
    </IfModule>
    ```
    Restart apache:
    ```
    sudo service apache2 restart
    ```
    In nginx site config specify port and upsteam:
    ```
    upstream ContactAppProduction {
    server unix:///tmp/MyAppProduction.sock;
    }
    server {
    listen *:8080;
    server_name site.com;
    ```
    Restart nginx:
    ```
    sudo service nginx restart
    ```
    Than run app just with upstream. [See](https://gist.github.com/1v/77595e676132a660843c).