Last active
August 25, 2017 11:32
-
-
Save acaire/9d03568c8424d00a33aba462da386ca5 to your computer and use it in GitHub Desktop.
netbox nginx with uwsgi
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sudo apt-get install nginx | |
pip install uwsgi |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# /etc/nginx/sites-available/netbox | |
server { | |
listen 80; | |
listen 443 ssl; | |
server_name netbox.yourdomain.com; | |
access_log off; | |
location /static/ { | |
alias /opt/netbox/netbox/static/; | |
} | |
if ($scheme = http) { | |
return 301 https://$server_name$request_uri; | |
} | |
location / { | |
include uwsgi_params; | |
uwsgi_pass unix:/opt/netbox/netbox.sock; | |
} | |
# serve under alternative location instead of / | |
#location /foobar { | |
# include uwsgi_params; | |
# uwsgi_pass unix:/opt/netbox/netbox.sock; | |
# uwsgi_param SCRIPT_NAME /foobar; | |
# uwsgi_modifier1 30; | |
#} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# /etc/init/uwsgi.conf | |
# Emperor uWSGI script | |
description "uWSGI Emperor" | |
start on runlevel [2345] | |
stop on runlevel [06] | |
respawn | |
exec uwsgi --emperor /etc/uwsgi/sites --uid www-data --gid www-data |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# /etc/uwsgi/sites/netbox.ini | |
[uwsgi] | |
project = netbox | |
base = /opt/%(project) | |
chdir = %(base)/%(project) | |
module = %(project).wsgi:application | |
master = True | |
processes = 2 | |
socket = %(base)/%(project).sock | |
chmod-socket = 664 | |
vacuum = True |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment