我正在尝试在 OpenLiteSpeed 上使用 CyberPanel 托管我的 Django 网站。我已经完成了网站开发。当我在调试模式下运行(使用 runserver 命令)时,网站运行正常。我正在尝试部署网站。
我正在使用 CyberPanel,因为我希望部署自己的 SMTP 服务器。
我已使用以下文章在我的数字海洋服务器上安装网络面板:https ://cyberpanel.net/docs/installing-cyberpanel/
我使用以下文章在 Openlitespeed 服务器上安装和配置基于 Django 的网站https://cyberpanel.net/blog/2019/01/10/how-to-setup-django-application-on-cyberpanel-openlitespeed/
当我尝试打开网站 unionelectronics.in 时,出现 503 Service Unavailable(服务器暂时繁忙,稍后再试!)错误。
我在 godaddy 上更新了 DNS 管理中的 A 记录,以指向我的云服务提供商(数字海洋)。
错误日志:
2021-10-05 14:53:37.241089 [INFO] [817] [config:server:vhosts:vhost:Example] config context /docs/.
2021-10-05 14:53:37.241103 [INFO] [817] [config:server:vhosts:vhost:Example] config context /protected/.
2021-10-05 14:53:37.242757 [INFO] [817] [PlainConf] [virtualHostConfig:] start parsing file /usr/local/lsws/conf/vhosts/unionelectronics.in/vhost.conf
2021-10-05 14:53:37.243519 [INFO] [817] [PlainConf] [virtualHostConfig:] Finished parsing file /usr/local/lsws/conf/vhosts/unionelectronics.in/vhost.conf
2021-10-05 14:53:37.243533 [INFO] [817] [PlainConf] [virtualHostConfig:] context [/] add param [envtype 1]
2021-10-05 14:53:37.251116 [NOTICE] [817] [SSL_CTX: 0x124eb20] OCSP Stapling can't be enabled: [OCSP] /etc/letsencrypt/live/unionelectronics.in/fullchain.pem: X509_STORE_CTX_get1_issuer failed!.
2021-10-05 14:53:37.251224 [INFO] [817] [config:server:vhosts:vhost:unionelectronics.in] config context /.
2021-10-05 14:53:37.257606 [INFO] [817] [PlainConf] [virtualHostTemplate:] start parsing file /usr/local/lsws/conf/templates/ccl.conf
2021-10-05 14:53:37.261988 [INFO] [817] [PlainConf] [virtualHostTemplate:] Finished parsing file /usr/local/lsws/conf/templates/ccl.conf
2021-10-05 14:53:37.262027 [INFO] [817] [PlainConf] [context:/] rewrite [] add rules [rewritefile .htaccess]
2021-10-05 14:53:37.262326 [INFO] [817] [PlainConf] [virtualHostTemplate:] start parsing file /usr/local/lsws/conf/templates/rails.conf
2021-10-05 14:53:37.274452 [INFO] [817] [PlainConf] [virtualHostTemplate:] Finished parsing file /usr/local/lsws/conf/templates/rails.conf
2021-10-05 14:53:37.274503 [INFO] [817] [PlainConf] [context:/] rewrite [] add rules [rewritefile .htaccess]
2021-10-05 14:53:37.274660 [NOTICE] [817] [ZConfManager] No VHosts added, do not send!
2021-10-05 14:53:37.275041 [NOTICE] [817] Instance is ready for service. m_fdCmd 29, m_fdAdmin 6.
2021-10-05 14:53:37.278573 [NOTICE] [817] [AutoRestarter] new child process with pid=848 is forked!
2021-10-05 14:53:37.279309 [NOTICE] [848] [*:80] Worker #1 activates SO_REUSEPORT #1 socket, fd: 22
2021-10-05 14:53:37.279352 [NOTICE] [848] [*:443] Worker #1 activates SO_REUSEPORT #1 socket, fd: 23
2021-10-05 14:53:37.279366 [NOTICE] [848] [UDP *:443] Worker #1 activates SO_REUSEPORT #1 socket, fd: 24
2021-10-05 14:53:37.279406 [INFO] [848] [UDP:0.0.0.0:443] initPacketsIn: allocated 100 packets
2021-10-05 14:53:37.279418 [INFO] [848] [UDP:0.0.0.0:7080] initPacketsIn: allocated 100 packets
2021-10-05 14:53:37.279605 [NOTICE] [848] AIO is not supported on this machine!
2021-10-05 14:53:37.279650 [NOTICE] [848] Successfully change current user to nobody
2021-10-05 14:53:37.279659 [NOTICE] [848] Core dump is enabled.
2021-10-05 14:53:37.279705 [INFO] [848] [union7914.655340]: locked pid file [/tmp/lshttpd/union7914.sock.pid].
2021-10-05 14:53:37.279729 [INFO] [848] [union7914.655340] remove unix socket for detached process: /tmp/lshttpd/union7914.sock
2021-10-05 14:53:37.279781 [NOTICE] [848] [LocalWorker::workerExec] VHost:unionelectronics.in suExec check uid 65534 gid 65534 setuidmode 0.
2021-10-05 14:53:37.279787 [NOTICE] [848] [LocalWorker::workerExec] Config[union7914.655340]: suExec uid 1002 gid 1002 cmd /usr/local/lsws/lsphp80/bin/lsphp, final uid 1002 gid 1002, flags: 0.
2021-10-05 14:53:37.299448 [NOTICE] [848] [union7914.655340] add child process pid: 850
2021-10-05 14:53:37.299497 [INFO] [848] [union7914.655340]: unlocked pid file [/tmp/lshttpd/union7914.sock.pid].
2021-10-05 14:53:37.299538 [INFO] [848] [wsgi:unionelectronics.in:/]: locked pid file [/tmp/lshttpd/unionelectronics.in:_.sock.pid].
2021-10-05 14:53:37.299541 [INFO] [848] [wsgi:unionelectronics.in:/] remove unix socket for detached process: /tmp/lshttpd/unionelectronics.in:_.sock
2021-10-05 14:53:37.306283 [NOTICE] [848] [LocalWorker::workerExec] VHost:unionelectronics.in suExec check uid 65534 gid 65534 setuidmode 0.
2021-10-05 14:53:37.306306 [NOTICE] [848] [LocalWorker::workerExec] Config[wsgi:unionelectronics.in:/]: suExec uid 65534 gid 65534 cmd /usr/local/lsws/fcgi-bin/lswsgi -m /home/company_website/companywebsiteproject/companywebsiteproject/wsgi.py, final uid 65534 gid 65534, flags: 0.
2021-10-05 14:53:37.314205 [NOTICE] [848] [wsgi:unionelectronics.in:/] add child process pid: 854
2021-10-05 14:53:37.314305 [INFO] [848] [wsgi:unionelectronics.in:/]: unlocked pid file [/tmp/lshttpd/unionelectronics.in:_.sock.pid].
2021-10-05 14:53:37.314358 [INFO] [848] [lsphp]: locked pid file [/tmp/lshttpd/lsphp.sock.pid].
2021-10-05 14:53:37.314362 [INFO] [848] [lsphp] remove unix socket for detached process: /tmp/lshttpd/lsphp.sock
2021-10-05 14:53:37.314425 [NOTICE] [848] [LocalWorker::workerExec] Config[lsphp]: suExec uid 65534 gid 65534 cmd /usr/local/lsws/lsphp73/bin/lsphp, final uid 65534 gid 65534, flags: 0.
2021-10-05 14:53:37.325014 [NOTICE] [848] [lsphp] add child process pid: 855
2021-10-05 14:53:37.325069 [INFO] [848] [lsphp]: unlocked pid file [/tmp/lshttpd/lsphp.sock.pid].
2021-10-05 14:53:37.325113 [NOTICE] [848] Setup swapping space...
2021-10-05 14:53:37.325224 [NOTICE] [848] LiteSpeed/1.7.14 Open
module versions:
modgzip 1.1
cache 1.62
modinspector 1.1
uploadprogress 1.1
mod_security 1.4
starts successfully!
更新(2021 年 8 月 10 日):
我删除了旧的 droplet,创建了一个新的 droplet 并重新安装了整个系统。
我添加了我添加的 vHost Conf 条目。我创建了一个虚拟环境 company_website 并在虚拟环境中创建了 companywebsiteproject 项目。
docRoot $VH_ROOT/public_html
vhDomain $VH_NAME
vhAliases www.$VH_NAME
adminEmails kpecengineers@gmail.com
enableGzip 1
enableIpGeo 1
index {
useServer 0
indexFiles index.php, index.html
}
errorlog $VH_ROOT/logs/$VH_NAME.error_log {
useServer 0
logLevel ERROR
rollingSize 10M
}
accesslog $VH_ROOT/logs/$VH_NAME.access_log {
useServer 0
logFormat "%h %l %u %t "%r" %>s %b "%{Referer}i" "%{User-Agent}i""
logHeaders 5
rollingSize 10M
keepDays 10
compressArchive 1
}
scripthandler {
add lsapi:union9108 php
}
extprocessor union9108 {
type lsapi
address UDS://tmp/lshttpd/union9108.sock
maxConns 10
env LSAPI_CHILDREN=10
initTimeout 600
retryTimeout 0
persistConn 1
pcKeepAliveTimeout 1
respBuffer 0
autoStart 1
path /usr/local/lsws/lsphp80/bin/lsphp
extUser union9108
extGroup union9108
memSoftLimit 2047M
memHardLimit 2047M
procSoftLimit 400
procHardLimit 500
}
phpIniOverride {
}
rewrite {
enable 1
autoLoadHtaccess 1
}
context / {
type App Server
location /home/unionelectronics.in/public_html/KPECproject/
binPath /usr/local/lsws/fcgi-bin/lswsgi
appType WSGI
startupFile KPECproject/wsgi.py
env PYTHONPATH=/home/unionelectronics.in/public_html/bin/python3:/home/unionelectronics.in/public_html/KPECproject
env LS_PYTHONBIN=/home/unionelectronics.in/public_html/bin/python3
}
当我转到 http://Server_IP 时,我得到 404 错误,而不是之前的 503 错误。当我访问http://unionelectronics.in/时,我得到 404 错误,而不是之前的 503 错误。
早些时候我在错误日志中收到错误,现在我没有收到任何错误。
我相信这个问题是因为
index {
useServer 0
indexFiles index.php, index.html
}
我应该如何重新路由到我的主页?
如果我删除 index.html 我得到 404 错误。如果我保留 index.html,我将获得默认的网络面板数据。