【发布时间】:2017-08-25 15:15:42
【问题描述】:
全部。 我正在使用带有 nginx 和 php5-fpm 的 debian。我让网站功能齐全,然后安装 Tor 来创建和洋葱网站。我成功地将其配置为加载 index.html,但是,当我使用 index.php 时,Tor 浏览器不显示该页面。相反,Tor 浏览器会下载 index.php。我不确定我需要进行哪些配置。我这样做的目的是为了学习。我不关心安全性或真正使用 .onion 网站。这让我很困扰,虽然没有弄清楚。谢谢你。
这是我在 /etc/nginx/sites-available/ 中的服务器块配置
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;
}
}
sn-ps/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;
感谢您的帮助!
【问题讨论】:
-
curl -v localhost在服务器上给你什么? -
Connection: keep-alive < ETag: "59a030bc-137" < Accept-Ranges: bytes < <?php // Version define('VERSION', '2.3.0.2'); // Configuration if (is_file('config.php')) { require_once('config.php'); } // Install if (!defined('DIR_APPLICATION')) { header('Location: install/index.php'); exit; } // Startup require_once(DIR_SYSTEM . 'startup.php'); * Connection #0 to host localhost left intact -
snippets/fastcgi-php.conf的内容是什么?将其添加到问题中 -
如果现有的 PHP 站点已经在运行,为什么不将洋葱地址添加到 server_name 块中呢?
server { server_name domain.com onionaddr.onion; ... }