Heim > Backend-Entwicklung > PHP-Tutorial > nginx如何配置子目录的fastcgi_pass?

nginx如何配置子目录的fastcgi_pass?

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Freigeben: 2016-06-06 20:40:07
Original
1552 Leute haben es durchsucht

<code>location /wordpress {
        alias          /usr/local/nginx-1.6.2/html/wordpress;
        fastcgi_pass   127.0.0.1:9000;
        fastcgi_index  index.php;
        fastcgi_param  SCRIPT_FILENAME  /usr/local/nginx-1.6.2/html/wordpress$fastcgi_script_name;
        include        fastcgi_params;
    }
</code>
Nach dem Login kopieren
Nach dem Login kopieren

发现SCRIPT_FILENAME会包含,/wordpress,怎么才能去掉这个子目录?只传递后面的部分?

回复内容:

<code>location /wordpress {
        alias          /usr/local/nginx-1.6.2/html/wordpress;
        fastcgi_pass   127.0.0.1:9000;
        fastcgi_index  index.php;
        fastcgi_param  SCRIPT_FILENAME  /usr/local/nginx-1.6.2/html/wordpress$fastcgi_script_name;
        include        fastcgi_params;
    }
</code>
Nach dem Login kopieren
Nach dem Login kopieren

发现SCRIPT_FILENAME会包含,/wordpress,怎么才能去掉这个子目录?只传递后面的部分?

ss --unix --all | grep php
输出类似:
u_str LISTEN 0 128 /run/php-fpm/php-fpm.sock 30653 * 0
我在 nginx.conf 中的配置
fastcgi_pass unix:/run/php-fpm/php-fpm.sock

Verwandte Etiketten:
Quelle:php.cn
Erklärung dieser Website
Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn
Aktuelle Ausgaben
Nginx-Lastausgleichsproblem
Aus 1970-01-01 08:00:00
0
0
0
Fehler beim Neustart von Nginx
Aus 1970-01-01 08:00:00
0
0
0
Nginx-Lastausgleich
Aus 1970-01-01 08:00:00
0
0
0
Nginx-Default.conf-Problem
Aus 1970-01-01 08:00:00
0
0
0
Beliebte Tutorials
Mehr>
Neueste Downloads
Mehr>
Web-Effekte
Quellcode der Website
Website-Materialien
Frontend-Vorlage