Nginx运行python,bash scrip

2024-10-04 03:16:42 发布

您现在位置:Python中文网/ 问答频道 /正文

我有一个nginx服务器,其配置我希望能够用新地址进行开发。”hooks.devel.nclab.com“(vim/etc/nginx/sites available.com”(维姆/etc/nginx/sites可用/devel.nclab.com网站)公司名称:

server {
    listen 443 ssl;
    ssl_certificate        /etc/nginx/ssl-keys/devel.nclab.crt;
    ssl_certificate_key    /etc/nginx/ssl-keys/devel.nclab.key;
    set $hook_home /home/labdevel/core/static/hooks;
    root $hook_home;
    server_name hooks.devel.nclab.com;

    location ~ (\.py|\.sh)${
        gzip off;
        root $hook_home;
        autoindex on;
        fastcgi_pass unix:/var/run/fcgiwrap.socket;
        include /etc/nginx/fastcgi_params;
        fastcgi_param DOCUMENT_ROOT $hook_home;
        fastcgi_param SCRIPT_FILENAME $hook_home$fastcgi_script_name;
    }
}

我创建了一个简单的python文件,目录为$hook\u home你好.py". 在

^{pr2}$

当我在浏览器中输入“https://hooks.devel.nclab.com:443/hello.py”并给我的用户和密码时,它会说:“404:找不到”。在

我在哪里把代码弄乱了?在

提前谢谢你的帮助。在


Tags: pycomsslhomeserveretcnginxdevel
1条回答
网友
1楼 · 发布于 2024-10-04 03:16:42

使用模块配置nginx

您只需将启动命令更改为

:静态模块

./configure  add-module=/path/to/nginx-python-module

:动态模块

^{pr2}$

:仅同步版本

./configure  add-module=/path/to/nginx-python-module 
             with-cc-op=-DNGX_PYTHON_SYNC=1

:配置之前python config的路径

export PYTHON_CONFIG=/path/to/python-config

相关问题 更多 >