2017-08-25 63 views
0

全部。 我用nginx和php5-fpm使用debian。我让网站功能齐全,然后安装Tor创建和洋葱网站。我成功地将其配置为加载index.html,但是,当我使用index.php时,Tor浏览器不显示页面。相反,Tor浏览器下载index.php。我不确定我需要做什么样的配置。我这样做的目的是为了学习。我不关心安全性或真正使用.onion网站。它困扰着我,尽管没有弄明白。谢谢。index.php不适用于TOR nginx

这是在我的服务器块配置的/ etc/nginx的/网站可用/

server { 
listen 127.0.0.1:80; 

root /var/www/html/; 
index index.php index.html index.htm; 
server_name 4bgxjb2vkb7tvsgw.onion; 

location/{ 
try_files $uri $uri/ =404; 
} 

location ~ \.php$ { 
root /var/www/html/; 
include snippets/fastcgi-php.conf; 
fastcgi_pass unix:/var/run/php5-fpm.sock; 
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; 
     include  fastcgi_params; 
} 

location ~ /\.ht { 
deny all; 
} 
} 

片段/ FastCGI的-php.conf:

# regex to split $uri to $fastcgi_script_name and $fastcgi_path 
fastcgi_split_path_info ^(.+\.php)(/.+)$; 

# Check that the PHP script exists before passing it 
try_files $fastcgi_script_name =404; 

# Bypass the fact that try_files resets $fastcgi_path_info 
# see: http://trac.nginx.org/nginx/ticket/321 
set $path_info $fastcgi_path_info; 
fastcgi_param PATH_INFO $path_info; 

fastcgi_index index.php; 
include fastcgi.conf; 

谢谢您的帮助!

+0

什么'卷曲-v localhost'给你的服务器上? –

+0

'连接:保持活着 theCodingJesus

+0

'snippets/fastcgi-php.conf'的内容是什么?将其添加到问题 –

回答

1

尝试这样:

location/{ 
    try_files $uri $uri/ =404; 
} 
error_page 401 403 404 /404.html; 
location = /404.html { 
root /usr/share/nginx/html; 
} 

error_page 500 502 503 504 /50x.html; 
location = /50x.html { 
    root /usr/share/nginx/html; 
} 

location ~ \.php$ { 
    try_files $uri =404; 
    fastcgi_split_path_info ^(.+\.php)(/.+)$; 
    fastcgi_pass unix:/var/run/php5-fpm.sock; 
    fastcgi_index index.php; 
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; 
    include fastcgi_params; 
} 
相关问题