其他扩展在nginx上作为PHP运行

时间:2018-01-09 07:29:43

标签: php nginx

好吧,我的问题

我希望.php ex更改为.pys ex

我使用的是软件 - OpenBSD, - Nginx 1.10, - PHP70, - PHP70 FastCGI

检查我的脚本nginx.conf

location ~ \.pys$ {
        try_files $uri =404;
        fastcgi_split_path_info ^(.+\.pys)(/.+)$;
        fastcgi_pass  127.0.0.1:9000;
        fastcgi_index index.php;
        fastcgi_param  SCRIPT_FILENAME $document_root$fastcgi_script_name;
        include fastcgi_params;
}

PHP正常

location ~ \.php$ {
        try_files $uri =404;
        fastcgi_split_path_info ^(.+\.php)(/.+)$;
        fastcgi_pass  127.0.0.1:9000;
        fastcgi_index index.php;
        fastcgi_param  SCRIPT_FILENAME $document_root$fastcgi_script_name;
        include fastcgi_params;
}

我试试

location ~ \.php|\.pys$ {
        try_files $uri =404;
       fastcgi_split_path_info ^(.+\.php)(/.+)$;
        fastcgi_pass  127.0.0.1:9000;
        fastcgi_index index.php;
        fastcgi_param  SCRIPT_FILENAME $document_root$fastcgi_script_name;
        include fastcgi_params;
}

不工作

我知道你可以帮助我

1 个答案:

答案 0 :(得分:0)

试试这个:

g++ isprime.cpp -std=c++11 -o isprime -pthread

你也可以看看这个。 How to Add Custom File Extension for PHP in Apache and Nginx

<强>更新
在访问以location ~ \.(php|pys)$ { try_files $uri =404; fastcgi_split_path_info ^(.+\.php)(/.+)$; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; } 结尾的链接后,我遇到了.pys错误,在我的系统上尝试后,我发现您的问题可能是由Access denied引起的。请检查this thread