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

Zayatzz's questions

Martin Hope
OdifYltsaeb
Asked: 2023-08-16 19:35:24 +0800 CST

为 WordPress 设置 nginx 的问题

  • 6

我的 /etc/nginx/sites-available/wordpress 中有以下 wordpress nginx 配置:

    index index.html index.htm index.nginx-debian.html;

    location / {
        proxy_pass http://nextjs;
        proxy_http_version 1.1;
            proxy_set_header X-Forwarded-Host $host;
            proxy_set_header X-Forwarded-Server $host;
            proxy_set_header X-Real-IP $remote_addr;
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
            proxy_set_header X-Forwarded-Proto $scheme;
            proxy_set_header Host $http_host;
            proxy_set_header Upgrade $http_upgrade;
            proxy_set_header Connection "Upgrade";
            proxy_pass_request_headers on;
    }


    location /wordpress {
        root /var/www;
        try_files $uri $uri/wordpress/ /wordpress/index.php$is_args?$args;

            location ~ \.php$ {
            include fastcgi_params;
            fastcgi_pass unix:/run/php/php8.1-fpm.sock;
            fastcgi_split_path_info ^(.+\.php)(/.+)$;
            fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
                    include snippets/fastcgi-php.conf;
                    fastcgi_buffers 1024 4k;
                    fastcgi_buffer_size 128k;
            }
    }

正如您所看到的,WordPress 有一个基于 NextJS 的静态前端。一般来说,它的效果很好。不过,有一个怪癖不起作用,我不确定这是 WordPress 问题还是 Nginx 问题。

  • 当用户导航到 /wordpress 时,我们会看到来自 wordpress 的内容,这很好
  • 当用户导航到 /wordpress/graphql 时,grahpql 端点工作正常
  • 当用户导航到 /wordpress/wp-admin 时,事情就会崩溃。存在重定向循环,brauser 报告该站点未正确重定向等等。
  • 当用户导航到 /wordpress/wp-admin/index.php 时,一切正常。

那么这是从哪里来的呢?这是 Nginx 的事情吗?WordPress 的事?我该如何解决?

编辑1:添加了curl -vvv输出:

C:\Users\alank>curl -vvv https://mydomain.ee/wordpress/wp-admin
*   Trying 194.204.13.171:443...
* Connected to mydomain.ee (194.204.13.171) port 443 (#0)
* schannel: disabled automatic use of client certificate
* ALPN: offers http/1.1
* ALPN: server did not agree on a protocol. Uses default.
* using HTTP/1.x
> GET /wordpress/wp-admin HTTP/1.1
> Host: mydomain.ee
> User-Agent: curl/8.0.1
> Accept: */*
>
* schannel: remote party requests renegotiation
* schannel: renegotiating SSL/TLS connection
* schannel: SSL/TLS connection renegotiated
* schannel: remote party requests renegotiation
* schannel: renegotiating SSL/TLS connection
* schannel: SSL/TLS connection renegotiated
< HTTP/1.1 302 Found
< server: nginx/1.18.0 (Ubuntu)
< date: Tue, 22 Aug 2023 10:19:10 GMT
< content-type: text/html; charset=UTF-8
< transfer-encoding: chunked
< expires: Wed, 11 Jan 1984 05:00:00 GMT
< cache-control: no-cache, must-revalidate, max-age=0
< link: <https://mydomain.ee/wordpress/wp-json/>; rel="https://api.w.org/"
< x-redirect-by: WordPress
< location: https://mydomain.ee/wordpress/wp-admin/
<
* Connection #0 to host mydomain.ee left intact

编辑2:curl -vvv 带有尾部斜杠:

C:\Users\alank>curl -vvv https://mydomain.ee/wordpress/wp-admin/
*   Trying 194.204.13.171:443...
* Connected to  mydomain.ee (194.204.13.171) port 443 (#0)
* schannel: disabled automatic use of client certificate
* ALPN: offers http/1.1
* ALPN: server did not agree on a protocol. Uses default.
* using HTTP/1.x
> GET /wordpress/wp-admin/ HTTP/1.1
> Host: mydomain.ee
> User-Agent: curl/8.0.1
> Accept: */*
>
* schannel: remote party requests renegotiation
* schannel: renegotiating SSL/TLS connection
* schannel: SSL/TLS connection renegotiated
* schannel: remote party requests renegotiation
* schannel: renegotiating SSL/TLS connection
* schannel: SSL/TLS connection renegotiated
< HTTP/1.1 302 Found
< server: nginx/1.18.0 (Ubuntu)
< date: Tue, 22 Aug 2023 11:13:01 GMT
< content-type: text/html; charset=UTF-8
< transfer-encoding: chunked
< expires: Wed, 11 Jan 1984 05:00:00 GMT
< cache-control: no-cache, must-revalidate, max-age=0
< link: <https://mydomain.ee/wordpress/wp-json/>; rel="https://api.w.org/"
< x-redirect-by: WordPress
< location: https://mydomain.ee/wordpress/wp-admin/
< 
* Connection #0 to host mydomain.ee left intact
nginx
  • 2 个回答
  • 109 Views
Martin Hope
Zayatzz
Asked: 2013-09-12 22:48:38 +0800 CST

Nginx bad gateway (502) error on django 500 错误(而不是显示 django 500 页面)与 DEBUG = False 设置

  • 1

我当前的设置有问题...问题是,如果我在 django settings.py 文件中设置 DEBUG = False,nginx 会停止在 500 错误上显示 django 回溯,但也不会显示我们的 500 页面。它只显示 nginx 502 bad gateway 错误。

我确实收到了带有回溯的电子邮件错误,就像我将其配置为在发生回溯时向我发送回溯一样。但我想向用户显示漂亮的 500 页面而不是 nginx 502 网关错误...

老实说,我什至不知道从哪里开始寻找问题的根源。我准备发布所有必要的配置文件,如果一些 nginx 专家会来告诉我他想看什么。

艾伦

Edit1:我查看了在这 500 个错误之一中显示的日志文件,它显示了这一点:

[pid: 16203|app: 0|req: 1/1] my.ip.address () {46 vars in 915 bytes} [Thu Sep 12 10:01:17 2013] GET /settings/personal/ => generated 0 bytes in 1249 msecs (HTTP/1.1 500) 0 headers in 0 bytes (0 switches on core 0)

这是否意味着它的某种 django 错误导致它看起来像 django 返回 0 字节?

nginx
  • 3 个回答
  • 3677 Views
Martin Hope
Zayatzz
Asked: 2013-04-21 00:07:33 +0800 CST

Wordpress 永久链接到达 apache 404 而不是 wordpress 404.php 或它们各自的真​​实页面。重定向或 apache 配置错误?

  • 0

我刚刚安装了干净的 wordpress 并设置了它的 .htaccess,就像他们说的那样:

http://codex.wordpress.org/Using_Permalinks

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress

当我尝试访问浏览器中的某个地址时,我http://localhost:888/blog/从服务器收到 404 错误。我什至没有被 wordpress 引导到 wordpess 自己的 404 页面。

当我查看我网站的错误日志时:

[Sat Apr 20 10:43:36 2013] [error] [client 127.0.0.1] File does not exist: /home/alan/projects/pin_wp/blog, referer: http://localhost:888/

所以这让我想到我在某个地方搞砸了我的虚拟主机 conf - 因为我是那个领域的一个大菜鸟:

alan@alan:~/projects/pin_wp$ cat /etc/apache2/sites-enabled/localhost-pinwp 
Listen 888
<VirtualHost *:888>
    ServerAdmin webmaster@localhost

    DocumentRoot /home/alan/projects/pin_wp
    ServerName html

    <Directory />
        Options FollowSymLinks
        AllowOverride None
    </Directory>
    <Directory /home/alan/projects/pin_wp>
        Options Indexes FollowSymLinks MultiViews +Includes
        AllowOverride None
        Order allow,deny
        allow from all
        AddOutputFilter INCLUDES .html
    </Directory>

    ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
    <Directory "/usr/lib/cgi-bin">
        AllowOverride None
        Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
        Order allow,deny
        Allow from all
    </Directory>

    ErrorLog ${APACHE_LOG_DIR}/error-pinwp.log

    # Possible values include: debug, info, notice, warn, error, crit,
    # alert, emerg.
    LogLevel warn

    CustomLog ${APACHE_LOG_DIR}/access-pinwp.log combined

    Alias /doc/ "/usr/share/doc/"
    <Directory "/usr/share/doc/">
        Options Indexes MultiViews FollowSymLinks
        AllowOverride None
        Order deny,allow
        Deny from all
        Allow from 127.0.0.0/255.0.0.0 ::1/128
    </Directory>

</VirtualHost>

有人可以帮我解决这个问题并指出我这次犯了什么样的愚蠢错误。

艾伦

linux
  • 1 个回答
  • 1553 Views
Martin Hope
Zayatzz
Asked: 2010-03-18 23:03:30 +0800 CST

FCGI & 重新编译 python 代码而不重新启动 apache

  • 2

在一家托管公司,他们曾经使用 fcgi 运行 python 项目。他们已经设置好了,所以当我更改 django.fcgi 文件时,将 django 和我的项目放在 pythonpath 上,我的项目代码会立即重新编译。

因此,一位朋友使用 fastcgi 在他的服务器中为我们的共享项目设置了托管。它已经设置好,python 脚本按应有的方式执行,但我们不知道如何设置它,以便在我的设置文件更改时重新编译我的项目。

艾伦

apache-2.2 python fcgi
  • 1 个回答
  • 1068 Views
Martin Hope
Zayatzz
Asked: 2009-08-20 04:20:06 +0800 CST

PHP 和 linux 权限

  • 1

地狱0

我们(我们的公司)一直在为我们创建的多个网站使用一个 CMS。我们现在已经多次遇到这个特殊问题,我们想不出解决办法。

以下是问题的描述: 在这个 cms 中可以创建图片库。当您通过 CMS 为图库创建文件夹时,该文件夹由 www 用户创建,其权限设置为 0666。当用户使用其编辑器视图将图片上传到此图库时,图片将上传到先前创建的文件夹并切成必要的大小. 创建.thumbnails 和其他文件夹来保存不同大小的图片。

如果您通过 ftp 为图库创建文件夹,则图库的所有者是 ftp 用户。如果您手动将权限设置为 0666 并以正确的权限上传文件,一切似乎都很好。现在在公共视图中,如果您选择这个先前创建的文件夹作为您的画廊文件夹,cms 将无法创建 .thumbnail 子目录(以及其他所需的子目录)。文件夹之间的唯一区别是文件夹的所有者。

现在我正试图掌握这个托管帐户的 php 日志。我想我会得到更多的信息。

艾伦

linux php permissions
  • 5 个回答
  • 840 Views
Martin Hope
Zayatzz
Asked: 2009-08-20 12:09:47 +0800 CST

Ubuntu:重新安装 jpeg 库

  • 0

我对linux不太了解,所以请花一点时间来弄清楚我在问什么。

背景故事可以在这里阅读:http ://groups.google.com/group/django-users/browse_thread/thread/5cd35edc04876523

但这里有一个简短的回顾:我安装了 stackless python,发现我必须自己编译几个 python 库才能让我的 django 项目重新启动并运行。我编译了 setuptools & python-mysqldb,我下载并编译了 jpeg、freetype2 和 PIL。

现在的问题是,当我使用模型格式上传文件时,django 无法验证图像文件。如果您对 django 或 python 一无所知,请不要拒绝这个问题。这个问题不一定是全部。

当跟踪 django 代码中引发错误的点时,我发现它是在 python 在上传图像上使用 Image.load() 函数的时候完成的。当我评论这条线时,我收到了这个错误:

IOError at /profile/edit/

decoder jpeg not available

Request Method:     POST
Request URL:    127.0.0.1/profile/edit/
Exception Type:     IOError
Exception Value:    decoder jpeg not available
Exception Location:     /usr/local/lib/python2.6/site-packages/PIL/Image.py in _getdecoder, line 375
Python Executable:  /usr/local/bin/python
Python Version:     2.6.2
Python Path:    ['/usr/local/lib/python2.6/site-packages/setuptools-0.6c9-py2.6.egg', '/usr/local/lib/python2.6/site-packages/MySQL_python-1.2.3c1-py2.6-linux-i686.egg', '/usr/local/lib/python2.6', '/usr/local/lib/python2.6/plat-linux2', '/usr/local/lib/python2.6/lib-tk', '/usr/local/lib/python2.6/lib-old', '/usr/local/lib/python2.6/lib-dynload', '/usr/local/lib/python2.6/site-packages', '/usr/local/lib/python2.6/site-packages/PIL', '/home/projects', '/home/projects/tst']

据我了解,它无法用 jpeg 做某事。这是否意味着即使我已经编译并安装了这个 jpeg 库(来自 ww.ijg.org 的 jpegsrc.v7.tar.gz),路径或其他东西仍然有问题。

我确实尝试在我编译 jpeg 的文件夹中执行 sudo make uninstall 并删除了我已安装的文件。但是 ubuntu 安装也安装了这个库,然后我才用 stackless 做任何事情。

因此,经过这么长的故事,问题是:我怎样才能从我的计算机中删除 Jpeg,这样我才能确保到处使用的 jpeg 解码器是我编译和安装的 jpeg 解码器?

艾伦

linux
  • 1 个回答
  • 1522 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