我有一个vps
服务器,Reg.ru
和{
在Reg.ru
上,我通过dnsadmin
添加了domain
。好吧。创建注释。状态-synchronized
。在
在domain
的管理面板的freenom
上是下一个字段:Name
,Type
,TTL
,Target
。Name
-空,TTL
-3600
,Type
-A
,Target
-ip
服务器。状态-active
。在
/etc/nginx/sites available/myproject和/etc/nginx/sites enabled/myproject
server {
listen 80;
server_name example.com;
location = /favicon.ico { access_log off; log_not_found off; }
location /static/ {
root /home/myproject;
}
location / {
include proxy_params;
proxy_pass http://unix:/run/gunicorn.sock;
}
}
/etc/nginx/nginx.conf公司
^{pr2}$nginx -t
-successful
systemctl status nginx
-active
ufw状态
Status: active
To Action From
-- ------ ----
8000 ALLOW Anywhere
80 ALLOW Anywhere
443 ALLOW Anywhere
8000 (v6) ALLOW Anywhere (v6)
80 (v6) ALLOW Anywhere (v6)
443 (v6) ALLOW Anywhere (v6)
当我在浏览器中打开vps-server
的ip时,我得到了nginx
的主页。在
/etc/systemd/系统/gunicorn服务
[Unit]
Description=gunicorn daemon
Requires=gunicorn.socket
After=network.target
[Service]
User=root
Group=root
WorkingDirectory=/home/myproject
ExecStart=/home/myproject/myprojectenv/bin/gunicorn \
--access-logfile - \
--workers 3 \
--bind unix:/run/gunicorn.sock \
myproject.wsgi:application
[Install]
WantedBy=multi-user.target
/etc/nginx/sites enabled#cat/etc/systemd/system/套筒
[Unit]
Description=gunicorn socket
[Socket]
ListenStream=/run/gunicorn.sock
[Install]
WantedBy=sockets.target
systemctl status gunicorn
-active
/home/myproject/myproject/。设置.py
ALLOWED_HOSTS = ['example.com', 'localhost']
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'NAME': 'test_db',
'USER': 'test_user',
'PASSWORD': 'test',
'HOST': 'localhost',
'PORT': '',
}
}
我运行一个manage.py runserver
,并从Django
得到响应,服务器是在^{
但是当我用domain
名称打开网站时,我得到了错误:
Unable to access site
Failed to find the IP address of the example.com server.
目前没有回答
相关问题 更多 >
编程相关推荐