[英]Nginx - running python, bash script
我有一台nginx服務器,其配置我希望能夠使用新地址“ hooks.devel.nclab.com”(vim /etc/nginx/sites-available/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;
}
}
我已經在$ hook_home的目錄“ hello.py”中創建了一個簡單的python文件。
print "hello"
當我在瀏覽器中輸入“ https://hooks.devel.nclab.com:443/hello.py ”並輸入我的用戶名和密碼時,它會顯示:“ 404:Not Found”。
我在哪里弄亂代碼?
提前謝謝你的幫助。
使用模塊配置Nginx
您只需要將啟動命令更改為
:靜態模塊
./configure --add-module=/path/to/nginx-python-module
:動態模塊
./configure --add-dynamic-module=/path/to/nginx-python-module
:僅同步版本
./configure --add-module=/path/to/nginx-python-module
--with-cc-op=-DNGX_PYTHON_SYNC=1
:配置之前python-config的路徑
export PYTHON_CONFIG=/path/to/python-config
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.