linux php5.2 nginx,搭建基于Linux6.3+Nginx1.2+PHP5+MySQL5.5的Web服务器全过程

五:安装Nginx

Nginx的rewrite需要perl库,所以先安装下。

tar zxf pcre-8.33.tar.gz

cd pcre-8.33

./configure

make && make install

cd ../

在安装Nginx前,先对Nginx做一些修改,如隐藏真实版本号,取消debug模式,利用TCMalloc库提升Nginx对内存的使用效率。

#set TCMalloc

wget http://ftp.twaren.net/Unix/NonGNU//libunwind/libunwind-1.1.tar.gz

tar zxf libunwind-1.1.tar.gz

cd libunwind-1.1

CFLAGS=-fPIC ./configure

make CFLAGS=-fPIC

make CFLAGS=-fPIC install

cd ..

wget https://gperftools.googlecode.com/files/gperftools-2.0.tar.gz

tar zxf gperftools-2.0.tar.gz

cd gperftools-2.0

./configure

make && make install

echo "/usr/local/lib" > /etc/ld.so.conf.d/usr_local_lib.conf

/sbin/ldconfig

tar zxf nginx-1.2.9.tar.gz

cd nginx-1.2.9

sed -i 's@#define NGINX_VERSION.*$@#define NGINX_VERSION      "1.5.4"@g' src/core/nginx.h

sed -i 's@#define NGINX_VER.*NGINX_VERSION$@#define NGINX_VER          "tengine/" NGINX_VERSION@g' src/core/nginx.h

sed -i 's@CFLAGS="$CFLAGS -g"@#CFLAGS="$CFLAGS -g"@g' auto/cc/gcc

./configure --user=nginx --group=nginx --prefix=/usr/local/nginx  \

--conf-path=/etc/nginx/nginx.conf --with-pcre \

--http-client-body-temp-path=/usr/local/nginx/tmp/client_body \

--http-proxy-temp-path=/usr/local/nginx/tmp/proxy --http-fastcgi-temp-path=/usr/local/nginx/tmp/fastcgi \

--http-uwsgi-temp-path=/usr/local/nginx/tmp/uwsgi --http-scgi-temp-path=/usr/local/nginx/tmp/scgi \

--pid-path=/var/run/nginx.pid --lock-path=/var/lock/subsys/nginx  \

--with-http_ssl_module --with-http_realip_module --with-http_addition_module \

--with-http_image_filter_module --with-http_sub_module --with-http_dav_module \

--with-http_gzip_static_module --with-http_random_index_module \

--with-http_secure_link_module --with-http_degradation_module --with-http_stub_status_module \

--with-file-aio

make && make install

为tcmalloc添加线程目

mkdir /tmp/tcmalloc

chmod 0777 /tmp/tcmalloc

在nginx.conf中添加一行配置

google_perftools_profiles /tmp/tcmalloc;

到此,LNMP环境就搭建完成了。接下来就是配置文件的修改和具体参数的调整了。任务依旧艰巨啊!

安装Nginx,配置参数少了一个--with-google_perftools_module,不然Nginx不会支持0b1331709591d260c1c78e86d0c51c18.png

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值