From a4cbfd7d5b2289fd8f874391afa8c5b031d06b3b Mon Sep 17 00:00:00 2001 From: Alex Conrey Date: Mon, 27 Jun 2016 19:51:46 -0500 Subject: [PATCH] added apache config information to getting-started.md --- docs/getting-started.md | 47 ++++++++++++++++++++++++++++++++++++++--- 1 file changed, 44 insertions(+), 3 deletions(-) diff --git a/docs/getting-started.md b/docs/getting-started.md index 8f2688aef..7395fdace 100644 --- a/docs/getting-started.md +++ b/docs/getting-started.md @@ -206,20 +206,26 @@ Now if we navigate to the name or IP of the server (as defined in `ALLOWED_HOSTS If the test service does not run, or you cannot reach the NetBox home page, something has gone wrong. Do not proceed with the rest of this guide until the installation has been corrected. -# nginx and gunicorn +# Web Server and gunicorn ## Installation -We'll set up a simple HTTP front end using [nginx](https://www.nginx.com/resources/wiki/) and [gunicorn](http://gunicorn.org/) for the purposes of this guide. (You are of course free to use whichever combination of HTTP and WSGI services you'd like.) We'll also use [supervisord](http://supervisord.org/) for service persistence. +We'll set up a simple HTTP front end using [gunicorn](http://gunicorn.org/) for the purposes of this guide. For web servers, we have 2 configurations ready to go - we provide instructions for both [nginx](https://www.nginx.com/resources/wiki/)and [Apache](http://httpd.apache.org/docs/2.4). (You are of course free to use whichever combination of HTTP and WSGI services you'd like.) We'll also use [supervisord](http://supervisord.org/) for service persistence. ``` -# apt-get install nginx gunicorn supervisor +# apt-get install gunicorn supervisor ``` ## nginx Configuration The following will serve as a minimal nginx configuration. Be sure to modify your server name and installation path appropriately. +``` +# apt-get install nginx +``` + +Once nginx is installed, proceed with the following configuration: + ``` server { listen 80; @@ -256,6 +262,40 @@ Restart the nginx service to use the new configuration. # service nginx restart * Restarting nginx nginx ``` +## Apache Configuration + +If you're feeling adventurous, or you already have Apache installed and can't run a dual-stack on your server - an Apache configuration has been created: + +``` + + ProxyPreserveHost On + + ServerName netbox.totallycool.tld + + Alias /static/ /opt/netbox/static/static + + + Options Indexes FollowSymLinks MultiViews + AllowOverride None + Order allow,deny + Allow from all + #Require all granted [UNCOMMENT THIS IF RUNNING APACHE 2.4] + + + + ProxyPass ! + + + ProxyPass / http://127.0.0.1:8001; + ProxyPassReverse / http://127.0.0.1:8001; + +``` + +Save the contents of the above example in `/etc/apache2/sites-available/netbox.conf`, add in the newly saved configuration and reload Apache: + +``` +# a2ensite netbox; service apache2 restart +``` ## gunicorn Configuration @@ -289,3 +329,4 @@ Finally, restart the supervisor service to detect and run the gunicorn service: At this point, you should be able to connect to the nginx HTTP service at the server name or IP address you provided. If you are unable to connect, check that the nginx service is running and properly configured. If you receive a 502 (bad gateway) error, this indicates that gunicorn is misconfigured or not running. Please keep in mind that the configurations provided here are a bare minimum to get NetBox up and running. You will almost certainly want to make some changes to better suit your production environment. +