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-334910

Till Kraemer's questions

Martin Hope
Till Kraemer
Asked: 2016-09-19 08:50:13 +0800 CST

运行 nginx 1.10.1、PHP 7.0.8、MariaDB 10.0.25 和 MediaWiki 1.27.1 的 OpenBSD 6.0 上的 PHP-FPM chroot 监狱中的 DNS

  • 0

我在 OpenBSD 6.0 上运行 nginx 1.10.1,包 php-7.0.8p0、php-curl-7.0.8p0、php-fastcgi-7.0.8p0、php-gd-7.0.8p0、php-mcrypt-7.0。 8p0、php-mysqli-7.0.8p0、mariadb-client-10.0.25v1 和 mariadb-server-10.0.25p0v1。

我有几个 MediaWiki 1.27.1 安装、一个图像池和几个访问该池的语言 wiki。每个安装都在 nginx 中配置了自己的虚拟子域。

php70_fpm 运行 chroot,/etc/php-fpm.conf 看起来像这样:

chroot = /path/to/chroot/jail

listen = /path/to/chroot/jail/run/php-fpm.sock

/etc/nginx/nginx/sites-available/en.domain.com 看起来像这样:

fastcgi_pass   unix:run/php-fpm.sock;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;

/etc/my.cnf 看起来像这样:

port            = 1234
socket          = /path/to/mysql.sock
bind-address    = 127.0.0.1
skip-external-locking
#skip-networking

当我尝试从 en.domain.com 上的 pool.domain.com 获取图像描述时,我收到“无法解析主机 pool.domain.com”错误。

一旦我在没有 chroot 的情况下运行 php_fpm,文件描述就会毫无问题地从池中获取。

我不想将 /etc 中的内容复制到 /path/to/chroot/jail 中,我该怎么办?我可以使用一些 PHP 7 模块吗?我必须玩 unbound 吗?

任何帮助都非常受欢迎!

谢谢和欢呼,

直到

nginx openbsd php-fpm mediawiki mariadb
  • 1 个回答
  • 1479 Views
Martin Hope
Till Kraemer
Asked: 2016-02-01 09:11:22 +0800 CST

在 nginx 上为移动子域的 request_uri 添加一个参数

  • 1

我在 nginx 1.9.3/OpenBSD 5.8 上运行多语言 wiki(MediaWiki 1.26.2 和MobileFrontend )。

对于每个语言 wiki,我都有一个单独的 MediaWiki 安装文件夹和一个指向该文件夹的子域(如 en.domain.com)。

我想使用桌面视图的 MediaWiki 安装文件夹为移动视图添加像 en.m.domain.com 这样的子域,但附加一个&mobileaction=toggle_view_mobile(或者?mobileaction=toggle_view_mobile如果已经有参数,则使用问号而不是 & 号) .

我还使用 CORS、短 URLhttp://和从to重定向https://。

这是我的服务器块的样子:

server {
    listen 80;
    server_name en.m.domain.com;
    root /path/to/domain/en;
    index index.html index.htm index.php;
    autoindex off;

# CORS
    add_header 'Access-Control-Allow-Origin' '*';
    add_header 'Access-Control-Allow-Credentials' 'true';
    add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
    add_header 'Access-Control-Allow-Headers' 'X-Requested-With, Accept, Content-Type, Origin';

# Redirect to https://

    if ($http_cf_visitor ~ '{"scheme":"http"}') {
        return 301 https://$server_name$request_uri;
        }

    location = / {
        return 301 https://en.m.domain.com/wiki/Main_Page;
        }

    location = /w {
        return 301 https://en.m.domain.com/wiki/Main_Page;
        }

    location = /w/ {
        return 301 https://en.m.domain.com/wiki/Main_Page;
        }

    location = /wiki {
        return 301 https://en.m.domain.com/wiki/Main_Page;
        }

    location = /wiki/ {
        return 301 https://en.m.domain.com/wiki/Main_Page;
        }

# Short URLs

    location / {
        index index.php;
        error_page 404 = @mediawiki;
        }

    location @mediawiki {
        rewrite ^/wiki([^?]*)(?:\?(.*))? /w/index.php?title=$1&$2 last;
        }

    location ~ \.php5?$ {
        try_files $uri =404;
        include fastcgi_params;
        fastcgi_pass   127.0.0.1:1234;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        fastcgi_intercept_errors on;
        }

    location ~ \.php?$ {
        try_files $uri =404;
        include fastcgi_params;
        fastcgi_pass   127.0.0.1:1234;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        fastcgi_intercept_errors on;
        }

# Append mobileaction=toggle_view_mobile for mobile version

    location / {                                                   

        # If there are no arguments add a question mark
        if ($args = '') {                                            
        set $new_request_uri "$request_uri?mobileaction=toggle_view_mobile";  
        }                                                            

        # If there are already arguments add an ampersand
        if ($args != "") {      
        set $new_request_uri "$request_uri&mobileaction=toggle_view_mobile";  
        }

        rewrite $new_request_uri last;        
        }       

}

不幸的是,这mobileaction=toggle_view_mobile部分不起作用:(

任何想法如何解决这一问题?

谢谢和欢呼,

直到

nginx
  • 1 个回答
  • 814 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