Skip to content

Instantly share code, notes, and snippets.

@acaire
Last active August 25, 2017 11:32
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save acaire/9d03568c8424d00a33aba462da386ca5 to your computer and use it in GitHub Desktop.
Save acaire/9d03568c8424d00a33aba462da386ca5 to your computer and use it in GitHub Desktop.
netbox nginx with uwsgi
sudo apt-get install nginx
pip install uwsgi
# /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;
#}
}
# /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
# /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