有没有ubuntu下编译nginx的教程,找了很多都是用源安装。我用源安装也不懂配置

2013 年 11 月 18 日
 coolicer
访问 index.php,把文件给我下载了。难道是没有开启解析PHP的组件吗?
4380 次点击
所在节点    Linux
18 条回复
nonozone
2013 年 11 月 18 日
应该是这样
alexrezit
2013 年 11 月 18 日
RTFM.
coolicer
2013 年 11 月 18 日
@alexrezit 我把之前的配置还原了,现在是403
Lax
2013 年 11 月 18 日
nginx不内置php解析。再看看php-fpm。
coolicer
2013 年 11 月 18 日
server {
listen 8080 default_server;
listen [::]:80 default_server ipv6only=on;

root /home/httpd;
index index.html index.htm;

server_name localhost;

location ~ \.php$ {

root /home/httpd;
fastcgi_pass 127.0.0.1:9000;

fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
coolicer
2013 年 11 月 18 日
@Lax 我的配置
AstroProfundis
2013 年 11 月 18 日
你9000端口上有php-fcgi进程么?用httpd的话应该把端口改掉,比如默认的80改成81,然后nginx里面 proxy_pass http://127.0.0.1:81;

如果是装了 php5-fpm 然后启动就是 fastcgi_pass 127.0.0.1:9000;
coolicer
2013 年 11 月 18 日
@AstroProfundis 没有9000进程,我是用源安装php和Nginx
F0ur
2013 年 11 月 18 日
php-fpm没开启吧。。
AstroProfundis
2013 年 11 月 18 日
@coolicer 那你显然要启动了后端才行啊...不过配置正确的话后端没启动应该是502错误,你试试改成 proxy_pass 到你的php-cgi端口
jtn007
2013 年 11 月 18 日
我跑rails,nginx是用passenger装的。。。
barbery
2013 年 11 月 18 日
ubuntu 上还要 sudo apt-get install php5-fpm
sandtears
2013 年 11 月 18 日
需要用fastcgi_pass转发给php5-fpm吧
hfcorriez
2013 年 11 月 19 日
看了你的解决方案,是你fpm配置监听方式的问题。

fpm分为端口监听和unix socket监听方式,前者对应你的IP端口,后者对应文件路径,nginx配置一致才能解决问题!
msg7086
2013 年 11 月 19 日
包管理默认的PHP-FPM的配置在 /etc/php5/fpm/pool.d/www.conf 里面可以改监听方式。

只要nginx和www.conf两者的设定相同就不会出问题
coolicer
2013 年 11 月 19 日
@hfcorriez 我也觉得有问题
coolicer
2013 年 11 月 19 日
@msg7086 谢谢,我刚接触,搞了好久才可以的。
coolicer
2013 年 11 月 19 日
@msg7086 我在www.conf 开了允许127.0.0.1也不行。还是要用回socket监听,我是在源安装的。

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/89653

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX