方法一:
1.安装GCC
yum install gcc
2.安装nginx
wget http://nginx.org/download/nginx-1.4.2.tar.gz
3.安装nginx依赖的库
yum install zlib-devel
yum install pcre-devel
/usr/local/nginx/sbin/nginx
/usr/local/nginx/sbin/nginx -s reload
4.安装 php-fpm
yum install php-fpm
service php-fpm start
service php-fpm stop
service php-fpm restart
service php-fpm reload
注意:重启nginx也要重启php-fpm,不然有问题哦
方法二:
Ø 安装nginx
yum install pcre
yum install pcre-devel
tar zxvf nginx-1.2.4.tar.gz
cd nginx-1.2.4/
./configure--prefix=/home/rsdm/nginx --without-http_gzip_module
make && make install
Ø 创建Nginx日志目录
mkdir -p /home/rsdm/nginx/logs
chmod +w /home/rsdm/nginx/logs
Ø 修改配置
vi /home/rsdm/nginx/conf/nginx.conf
events {
worker_connections65535;
use epoll;
}
http中sever改为
server {
listen 8160; #端口
server_name localhost; #服务名
root /home/rsdm/nginx/html/; #显示的根索引目录
autoindexon; #开启索引功能
autoindex_exact_sizeon;
autoindex_localtimeon; # 显示本机时间而非 GMT 时间
location/firmware/ {
alias/home/rsdm/OTA1.0/otafumopkgs/; #固件升级目录
}
location /appfile/{
alias/home/rsdm/OTA1.0/file/appfile/; #应用升级目录
}
}
Ø 启动
ulimit -SHn 65535
/home/rsdm/nginx/sbin/nginx启动
/home/rsdm/nginx/sbin/nginx -s reload平滑重启(加载配置文件)
service php-fpm reload
注意:重启nginx也要重启php-fpm,不然有问题哦
nginx安装第三方模块
http://www.ttlsa.com/nginx/how-to-install-nginx-third-modules/