|
@@ -1,18 +1,29 @@
|
|
|
# Web Server Installation
|
|
|
|
|
|
-We'll set up a simple WSGI front end using [gunicorn](http://gunicorn.org/) for the purposes of this guide. For web servers, we provide example configurations 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/) to enable service persistence.
|
|
|
+We'll set up a simple WSGI front end using [gunicorn](http://gunicorn.org/) for the purposes of this guide. For web servers, we provide example configurations 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/) to enable service persistence.
|
|
|
|
|
|
+Debian/Ubuntu
|
|
|
```
|
|
|
# sudo apt-get install -y gunicorn supervisor
|
|
|
```
|
|
|
+Centos/RHEL
|
|
|
+```
|
|
|
+# sudo yum install -y gunicorn supervisor
|
|
|
+```
|
|
|
|
|
|
## Option A: nginx
|
|
|
|
|
|
The following will serve as a minimal nginx configuration. Be sure to modify your server name and installation path appropriately.
|
|
|
|
|
|
+Debian/Ubuntu
|
|
|
+
|
|
|
```
|
|
|
# sudo apt-get install -y nginx
|
|
|
```
|
|
|
+Centos/RHEL
|
|
|
+```
|
|
|
+# sudo yum install -y nginx
|
|
|
+```
|
|
|
|
|
|
Once nginx is installed, proceed with the following configuration:
|
|
|
|
|
@@ -43,7 +54,7 @@ Save this configuration to `/etc/nginx/sites-available/netbox`. Then, delete `/e
|
|
|
```
|
|
|
# cd /etc/nginx/sites-enabled/
|
|
|
# rm default
|
|
|
-# ln -s /etc/nginx/sites-available/netbox
|
|
|
+# ln -s /etc/nginx/sites-available/netbox
|
|
|
```
|
|
|
|
|
|
Restart the nginx service to use the new configuration.
|
|
@@ -57,9 +68,16 @@ To enable SSL, consider this guide on [securing nginx with Let's Encrypt](https:
|
|
|
|
|
|
## Option B: Apache
|
|
|
|
|
|
+Debian/Ubuntu
|
|
|
+
|
|
|
```
|
|
|
# sudo apt-get install -y apache2
|
|
|
```
|
|
|
+Centos/RHEL
|
|
|
+
|
|
|
+```
|
|
|
+# sudo yum install -y httpd
|
|
|
+```
|
|
|
|
|
|
Once Apache is installed, proceed with the following configuration (Be sure to modify the `ServerName` appropriately):
|
|
|
|
|
@@ -99,7 +117,7 @@ To enable SSL, consider this guide on [securing Apache with Let's Encrypt](https
|
|
|
|
|
|
# gunicorn Installation
|
|
|
|
|
|
-Save the following configuration file in the root netbox installation path (in this example, `/opt/netbox/`) as `gunicorn_config.py`. Be sure to verify the location of the gunicorn executable (e.g. `which gunicorn`) and to update the `pythonpath` variable if needed.
|
|
|
+Save the following configuration file in the root netbox installation path (in this example, `/opt/netbox/`) as `gunicorn_config.py`. Be sure to verify the location of the gunicorn executable (e.g. `which gunicorn`) and to update the `pythonpath` variable if needed. If using centos/RHEL use the apache user instead of www-data.
|
|
|
|
|
|
```
|
|
|
command = '/usr/bin/gunicorn'
|
|
@@ -109,6 +127,7 @@ workers = 3
|
|
|
user = 'www-data'
|
|
|
```
|
|
|
|
|
|
+
|
|
|
# supervisord Installation
|
|
|
|
|
|
Save the following as `/etc/supervisor/conf.d/netbox.conf`. Update the `command` and `directory` paths as needed.
|