2017-08-25 66 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; 
} 
相關問題