找回密码
 注册
搜索
热搜: 回贴
微赢网络技术论坛 门户 服务器 Linux/BSD 查看内容

naginx安装和设定

2009-12-20 13:43| 发布者: admin| 查看: 74| 评论: 0|原作者: 慕容紫英



安装PHP

./configure \
--prefix=/usr/local/php5 \
--enable-fastcgi \
--enable-debug \
--with-openssl=/usr/local/openssl-0.9.8i \
--with-zlib \
--with-bz2 \
--with-curl \
--enable-ftp \
--with-gd \
--with-jpeg-dir \
--with-png-dir \
--with-zlib-dir \
--with-xpm-dir \
--with-ttf \
--with-freetype-dir \
--with-gettext \
--enable-mbstring \
--with-mcrypt \
--with-mhash \
--with-mysql \
--with-mysql-sock \
--enable-sockets \
--with-iconv-dir \
--with-libxml-dir \
--with-libexpat-dir && make && make install

安装MySQL:
./configure \
--prefix=/usr/local/mysql5 \
--with-charset=utf8 && make && make install
ln -s /usr/local/php5/bin/php /usr/local/bin/

修改php.ini
cp php.ini-dist /usr/local/lib/php.ini
vi php.ini
cgi.fix_pathinfo=1
;doc_root =

安装lighttpd
lighttpd
./configure --prefix=/usr/local/lighttpd && make && make install
cp /usr/local/lighttpd/bin/spawn-fcgi /usr/local/nginx/sbin/spawn-fcgi
ln -s /usr/local/nginx/sbin/spawn-fcgi /usr/local/bin/

安装nginx
nginx
./configure --prefix=/usr/local/nginx --with-zlib=/usr/lib/ --with-openssl=/usr/local/openssl-0.9.8i/ --with-http_stub_status_module --with-http_gzip_static_module --with-http_sub_module --with-http_dav_module

启动php-cgi
groupadd lighttpd
useradd -g lighttpd lighttpd
/usr/local/bin/spawn-fcgi -a 127.0.0.1 -p 10005 -u lighttpd -g lighttpd -f /usr/local/php5/bin/php-cgi

设定nginx.conf
cp fastcgi_params.default fastcgi.conf
cp nginx.conf.default nginx.conf
vi nginx.conf
user lighttpd lighttpd;
worker_processes 5;
error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;
pid logs/nginx.pid;
events {
use epoll;
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
root /home/kingsoft/;
log_format main '$remote_addr - $remote_user [$time_local] $request '
'"$status" $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log logs/access.log main;
sendfile on;
tcp_nopush on;
#keepalive_timeout 0;
keepalive_timeout 65;
gzip on;
server {
listen 80;
server_name localhost;
#charset koi8-r;
access_log logs/host.access.log main;
location / {
root /home/kingsoft/;
index index.html index.htm index.php;
}
error_page 404 /404.html;
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
location ~ \.php$ {
root html;
fastcgi_pass 127.0.0.1:10005;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /home/kingsoft/$fastcgi_script_name;
include fastcgi_params;
}
location ~ /\.ht {
deny all;
}
}
}

需要注意参数:
fastcgi_param SCRIPT_FILENAME 你的php文件的目录
/usr/local/nginx/sbin/nginx
如果没有设定对,浏览器就会输出:
No input file specified
(本文完)





最新评论

QQ|小黑屋|最新主题|手机版|微赢网络技术论坛 ( 苏ICP备08020429号 )

GMT+8, 2024-9-30 09:33 , Processed in 0.147377 second(s), 12 queries , Gzip On, MemCache On.

Powered by Discuz! X3.5

© 2001-2023 Discuz! Team.

返回顶部