Add nginx instructions

Noah 2015-06-16 20:38:31 -07:00
parent 03067c1956
commit 7df11b83ed

@ -3,6 +3,8 @@
Copy the file `config-sample.py` as a file named `config.py`, and edit its contents to set up your site. It's very important that you change the `SECRET_KEY` variable, as this is used to sign the session cookies and
prevent people from tampering with them. The config script is well-documented with comments explaining what all the options do.
See [Apache](#apache-configurations) and [nginx](#nginx-configurations) configurations.
# Apache Configurations
## mod_wsgi
@ -127,4 +129,57 @@ if __name__ == "__main__":
WSGIServer(app).run()
```
# nginx configurations
This is how to get it set up with nginx, supervisor and gunicorn.
## supervisor
Install supervisor and create a config file like `/etc/supervisor/conf.d/rophako.conf` with these contents:
```ini
[program:rophako]
command = /home/www-data/.virtualenv/rophako/bin/gunicorn -b 127.0.0.1:9000 wsgi_gunicorn:app
environment = ROPHAKO_SETTINGS="/home/www-data/site/settings.ini"
directory = /home/www-data/git/rophako
user = www-data
```
Reload supervisor and start your app:
```bash
$ supervisorctl reread
$ supervisorctl reload
$ supervisorctl start rophako
```
## nginx config
Add your site to `/etc/nginx/sites-available` with a config like this:
```nginx
server {
server_name www.example.com example.com;
listen 80;
root /home/www-data/git/rophako;
location /static {
alias /home/www-data/www/static;
}
location /favicon.ico {
alias /home/www-data/www/favicon.ico;
}
location / {
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_pass http://127.0.0.1:9000;
}
}
```
Start or restart nginx, `service nginx restart`
**Next Step:** [[Configuration and Plugins]]