Cherrypy部署-Nginx-javascript
我在服务器上构建了一个应用程序,目标是将其置于Nginx之后 该应用程序实际上是cherrypy示例(或其附近)中的教程8 nginx配置:Cherrypy部署-Nginx-javascript,javascript,nginx,cherrypy,Javascript,Nginx,Cherrypy,我在服务器上构建了一个应用程序,目标是将其置于Nginx之后 该应用程序实际上是cherrypy示例(或其附近)中的教程8 nginx配置: location /Cloning/ { proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $remo
location /Cloning/ {
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header X-Originating-IP $remote_addr;
proxy_set_header HTTP_REMOTE_ADDR $remote_addr;
proxy_set_header REMOTE_ADDR $remote_addr;
proxy_set_header CLIENT_IP $remote_addr;
proxy_pass http://0.0.0.0:8088/;
}
在服务器名为8088(cherrypy Web服务器被配置为服务于该页面上的页面)下访问时,应用程序按预期运行(javascript正在工作)。
但是,当我想通过Nginx位置server_name/Cloning/连接到它时,javascript不起作用。
我错过了什么,或者我应该检查什么?
我想这与nginx有关,因为当直接连接到应用程序时,该应用程序会发挥魅力,但当通过nginx连接时,它不会
如有任何建议,将不胜感激
樱桃密码
#!/usr/bin/env python3
import cherrypy
import os
from app import *
#app = cherrypy.tree.mount(InbioseCloning(), '/')
if __name__=='__main__':
cherrypy.config.update({
'server.socket_host': '0.0.0.0',
'server.socket_port': 8088,
'log.access_file' : './logs/log_access.txt',
'log.screen' : True,
'log.error_file' : './logs/log_error.txt'
})
conf = {
'/': {
'tools.sessions.on': True,
'tools.staticdir.root': os.path.abspath(os.getcwd()),
'tools.sessions.timeout':60
},
'/projectfetcher': {
'request.dispatch': cherrypy.dispatch.MethodDispatcher(),
'tools.response_headers.on': True,
'tools.response_headers.headers': [('Content-Type', 'text/plain')],
},
'/static': {
'tools.staticdir.on': True,
'tools.staticdir.dir': './public'
},
'/data_folder': {
'tools.staticdir.on': True,
'tools.staticdir.dir': './data_folder'
}
}
webapp = CloningHomepage()
webapp.projectfetcher = ProjectFetcherService()
# webapp.lvl1creatorservice = Lvl1CreatorService()
# Run the application using CherryPy's HTTP Web Server
cherrypy.quickstart(webapp,'/', conf)
如何提供静态服务?这是什么意思?
location/{首先尝试将请求作为文件,然后作为目录,然后返回到显示404。try_files$uri$uri/=404;}location/{首先尝试将请求作为文件,然后作为目录,然后返回到显示404。try_files$uri$uri/=404;}错误\u第404/404.html页;错误\u第500页502 503 504/50x.html;location=/50x.html{root/usr/share/nginx/html;}
这些是我的nginx的相关部分我猜有没有cherrypy代码?添加到初始帖子中您使用的cherrypy/python的版本是什么?您是否将cherrypy应用程序作为守护进程运行?有日志输出吗?(nginx和cherrypy)