AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / user-125528

carrot's questions

Martin Hope
carrot
Asked: 2012-11-28 03:50:24 +0800 CST

nginx:将一个不存在的 php 文件重写为另一个包含所有参数的 php 文件

  • 1

我真的需要帮助。现在坐了一段时间,不明白。

我想实现一个非常简单的任务——将一个不存在的 php 文件重写为另一个存在的 php 文件,所有参数如下:

this  http://example.com/nonexistent.php?url=google.com
to -> http://example.com/existent.php?url=google.com

我试过这样的事情:

rewrite ^/nonexistent.php /existent.php;

哪个不起作用(找不到文件)。但是将一个不存在的 html 文件重定向到一个 php 文件,如下所示:

rewrite ^/nonexistent.html /existent.php;

作品。

我不想重写 html 文件,但这仍然是一个令人困惑的行为。

因此它也尝试了这样的事情(和一些变体):

rewrite ^/nonexistent.php?url=^(.*)$ /existent.php?url=$1;

这也不起作用。(也许语法不好)

这里有什么帮助吗?这将是非常好的!

nginx
  • 1 个回答
  • 2066 Views
Martin Hope
carrot
Asked: 2012-11-20 07:33:33 +0800 CST

nginx:禁止访问文件夹,某些子文件夹除外

  • 2

如何拒绝对文件夹的访问,但将其中的某些子文件夹从“拒绝”中排除?

我试过这样的事情(按此顺序):

#这个子文件夹不应该被拒绝并且里面的php脚本应该是可执行的

位置 ~ /data/public { 允许所有;}

#this 文件夹包含许多子文件夹,应该拒绝公共访问

位置〜/数据{全部拒绝;返回 404;}

...这不能正常工作。/data/public 文件夹中的文件是可以访问的(/data 中的所有其他文件都应该被拒绝),但是 /data/public 文件夹中的 PHP 文件不再执行(如果我不添加这些限制,PHP文件是可执行的)。

怎么了?怎么可能是对的?我认为有更好的方法来做到这一点。

如果有人可以帮助我,那就太好了:)。


谢谢,但是 PHP 文件仍然没有在 /data/public/ 文件夹中执行,就像一个简单的

<? echo "test"; ?>

它为您提供此文件作为下载(没有上面的“拒绝”配置,php 文件运行良好)。

我的 PHP 配置:

location ~ \.php$ {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/var/run/php-fpm/php-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;
}

/data/ 之外的所有其他目录中的 PHP 文件正在工作......(其他子文件夹也是如此)。

php
  • 2 个回答
  • 34360 Views
Martin Hope
carrot
Asked: 2012-06-22 06:33:47 +0800 CST

后缀“邮件到脚本”管道仅传送空邮件

  • 0

我这里有问题。

我希望通过 postfix 将传入的电子邮件传输到系统中的 php 脚本。

我的系统正在运行 ispconfig 3、postfix 和 dovecot(< 虚拟邮箱用户保存在 mysql 中)。

我已经研究过这个:How to configure postfix to pipe all incoming email to a script?

...脚本已执行,但没有“消息”传递给脚本。到目前为止我的设置:

在 ISPConfig 3 中,我设置了以下电子邮件路由:

Active      Server          Domain              Transport   Sort by
Yes         example.com     pipe.example.com    piper:      5

摘自我的后缀 master.cf:

piper   unix  -       n       n       -       -       pipe
    user=piper:piper directory=/home/piper argv=php -q /home/piper/mail.php

到目前为止它运行良好(邮件发送到 [email protected])(mail.log):

Jun 21 16:07:11 example postfix/pipe[10948]: 235CF7613E2: to=<[email protected]>, relay=piper, delay=0.04, delays=0.01/0.01/0/0.02, dsn=2.0.0, status=sent (delivered via piper service)

...并且 mail.err 中没有错误

mail.php 成功执行(它的 chmod 777 和 chown'ed 到 piper),但创建一个空的 .txt 文件(通常它应该包含电子邮件消息):

-rw------- 1 piper piper    0 Jun 21 16:07 mailtext_1340287631.txt

我使用的 mail.php 脚本来自http://www.email2php.com/HowItWorks

如果我使用他们的(商业)服务通过提供的“pipe-email”将电子邮件通过管道发送到 mail.php(在 apache2 环境中),则该消息将成功保存并完成。但如您所见,我不想使用外部服务。

-rw-r--r--  1 web2 client0  1959 Jun 21 16:19 mailtext_1340288377.txt

那么,这里出了什么问题?我认为这与我系统中的“传递配置”有关......

php email postfix pipe
  • 1 个回答
  • 2306 Views

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    新安装后 postgres 的默认超级用户用户名/密码是什么?

    • 5 个回答
  • Marko Smith

    SFTP 使用什么端口?

    • 6 个回答
  • Marko Smith

    命令行列出 Windows Active Directory 组中的用户?

    • 9 个回答
  • Marko Smith

    什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同?

    • 3 个回答
  • Marko Smith

    如何确定bash变量是否为空?

    • 15 个回答
  • Martin Hope
    Tom Feiner 如何按大小对 du -h 输出进行排序 2009-02-26 05:42:42 +0800 CST
  • Martin Hope
    Noah Goodrich 什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同? 2009-05-19 18:24:42 +0800 CST
  • Martin Hope
    Brent 如何确定bash变量是否为空? 2009-05-13 09:54:48 +0800 CST
  • Martin Hope
    cletus 您如何找到在 Windows 中打开文件的进程? 2009-05-01 16:47:16 +0800 CST

热门标签

linux nginx windows networking ubuntu domain-name-system amazon-web-services active-directory apache-2.4 ssh

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve