&引用;站点可以';“联系不到”;在uwsgi上托管2个不同的django网站时
我目前正在尝试使用Nginx和Uwsgi在一台AWS服务器上托管两个不同的Django网站 以下是我的配置文件: 网站1.ini&引用;站点可以';“联系不到”;在uwsgi上托管2个不同的django网站时,django,amazon-web-services,nginx,uwsgi,Django,Amazon Web Services,Nginx,Uwsgi,我目前正在尝试使用Nginx和Uwsgi在一台AWS服务器上托管两个不同的Django网站 以下是我的配置文件: 网站1.ini [uwsgi] # django-related settings # the base directory (full path) project_name = backend base_dir = /home/ubuntu/website1/ virtualenv = /home/ubuntu/website1/env #chdir
[uwsgi]
# django-related settings
# the base directory (full path)
project_name = backend
base_dir = /home/ubuntu/website1/
virtualenv = /home/ubuntu/website1/env
#chdir = location where manage.py is present
chdir = %(base_dir)/backend
# django's wsgi file
module = %(project_name).wsgi:application
# the virtualenv (full-path)
# process related settings
# master
master = true
# maximum number of processes
processes = 10
# the socket (use the full path to be safe)
socket = /home/ubuntu/server_files/website1socket.sock
# ... with appropriate permissions - may be needed
chmod-socket = 666
# clearn environment on exit
vacuum = true
网站2.ini
[uwsgi]
# django-related settings
# the base directory (full path)
project_name = website2backend
base_dir = /home/ubuntu/website2/
virtualenv = /home/ubuntu/website2/env
#chdir = location where manage.py is present
chdir = %(base_dir)/djangoRestApi
# django's wsgi file
module = %(project_name).wsgi:application
# the virtualenv (full-path)
#:home = /home/ubuntu/website2/env
# process related settings
# master
master = true
# maximum number of processes
processes = 5
# the socket (use the full path to be safe)
socket = /home/ubuntu/server_files/website2socket.sock
# ... with appropriate permissions - may be needed
chmod-socket = 666
# clearn environment on exit
vacuum = true
伊尼皇帝
[uwsgi]
emperor = /home/ubuntu/server_files/vassals
uid = ubuntu
gid = ubuntu
website1.conf(/etc/nginx/sites available/)
我能够成功地启动服务器,但只能访问其中一个站点(端口8000处的站点),而另一个站点刚刚返回
This site can’t be reached
<IP Address> took too long to respond.
Try:
Checking the connection
Checking the proxy and the firewall
Running Windows Network Diagnostics
ERR_CONNECTION_TIMED_OUT
无法访问此站点
反应时间太长了。
尝试:
检查连接
检查代理和防火墙
运行Windows网络诊断
错误\u连接\u超时\u
我做错什么了吗?是否可以将两个站点托管在同一个服务器IP上但不同的端口上?请帮忙
提前谢谢
upstream django_two {
server unix:///home/ubuntu/server_files/website2socket.sock; # for a file socket
}
# configuration of the server
server {
# the port your site will be served on
listen 8000;
# the domain name it will serve for
server_name <my server IP>; # substitute your machine's IP address or FQDN
charset utf-8;
# max upload size
client_max_body_size 75M; # adjust to taste
# Django media
location /media {
alias /path/to/your/mysite/media; # your Django project's media files - amend as required
}
location /static {
alias /home/ubuntu/website2/djangoRestApi/static; # your Django project's static files - amend as required
}
# Finally, send all non-media requests to the Django server.
location / {
uwsgi_pass django_two;
include /home/ubuntu/server_files/uwsgi_params; # the uwsgi_params file you installed
}
error_log /home/ubuntu/mpac-nginx-log.log;
}
[Unit]
Description=uWSGI instance to serve both websites (EMPEROR)
After=network.target
[Service]
User=ubuntu
Group=ubuntu
ExecStart=/usr/local/bin/uwsgi --emperor /home/ubuntu/server_files/emperor.iniRestart=alwaysKillSignal=SIGQUIT
Type=notify
NotifyAccess=all
[Install]
WantedBy=multi-user.target
This site can’t be reached
<IP Address> took too long to respond.
Try:
Checking the connection
Checking the proxy and the firewall
Running Windows Network Diagnostics
ERR_CONNECTION_TIMED_OUT