nginx + uwsgi + python3配置不起作用

时间:2017-02-07 23:20:53

标签: python python-3.x nginx vagrant uwsgi

所以我试图遵循这个教程:http://jronnholm.sysio.se/setup-nginx-and-uwsgi-with-python3-on-ubuntu-14-04/

我正在使用vagrant和virtualbox,端口转发从8080到80

root@vagrant:/etc/nginx/sites-available# cat pythonapp
server {
    server_name pythonapp;
    error_log  /var/log/nginx/pythonapp.error.log;
    access_log         /var/log/nginx/pythonapp.access.log;
    root /vagrant/site/python/pythonapp;
    location / {
        uwsgi_pass unix:/var/run/uwsgi/app/pythonapp/socket;
        include uwsgi_params;
    }
}


root@vagrant:/etc/nginx/sites-available# cat /etc/uwsgi/apps-available/pythonapp.ini
[uwsgi]
uid=www-data
gid=www-data
# socket line should match uwsgi_pass line in your nginx config
socket = /var/run/uwsgi/app/pythonapp/socket
chown-socket = www-data
chdir = /vagrant/site/python/pythonapp
file = webpage.py
root@vagrant:/etc/nginx/sites-available#

root@vagrant:/vagrant/site/python# ls -l
total 2
drwxrwxrwx 1 vagrant vagrant   0 Feb  7 22:59 pythonapp
-rwxrwxrwx 1 vagrant vagrant 155 Feb  7 19:59 pythonapp.ini
-rwxrwxrwx 1 vagrant vagrant 160 Feb  2 08:27 wsgi.py
-rwxrwxrwx 1 vagrant vagrant 378 Feb  2 08:27 wsgi.pyc
root@vagrant:/vagrant/site/python#

但是当我转到http://localhost:8080时,它最终会返回

Welcome to nginx!

If you see this page, the nginx web server is successfully installed and working. Further configuration is required.

For online documentation and support please refer to nginx.org.
Commercial support is available at nginx.com.

Thank you for using nginx.

webpage.py的内容

root@vagrant:/vagrant/site/python/pythonapp# cat webpage.py
from bottle import route, run, template, default_app

@route('/hello/<name>')
def index(name):
    return template('<b>Hello {{name}}</b>!', name=name)

if __name__ == "__main__":
    run(host='localhost', port=8080)
else:
    application = default_app()

当我转到http://localhost:8080/hello/name时,即使教程建议转到/ hello / name也应该加载webpage.py ...

我做错了什么?

0 个答案:

没有答案