源码构建Lnmp坏境

 

一.、编译安装nginx-1.0.11.tar.gz

Nginx软件的安装依赖gcc编译器、openssl-devel、pcre-devel和zlib-devel,所以

安装Nginx之前,先确保系统上已经安装上了这些软件包;若没有安装,则先

配好yum源,使用yum命令安装。

#yum install gcc openssl-devel pcre-devel zlib-devel #安装编译安装的开发工具

1.tar -zxvf libevent-2.0.16 -C /usr/src

2.cd  /usr/src/libevent-2.0.16
3.   ./configure
4 make&&make install
5 vim /etc/ld.so.conf.d/libevent.conf
 加上 /usr/local/lib
6 ldconfig -v |grep libevent
 

 
 
7 . tar -zxvf nginx-1.0.11.tar.gz  -C /usr/src
8 . cd  /usr/src/nginx-1.0.11
9 . groupadd  -r  nginx  添加nginx组
10. useradd -r -g nginx -s /bin/false  -M nginx 添加nginx用户 
11
./configure \
 --prefix=/usr \
 --sbin-path=/usr/sbin/nginx \
 --conf-path=/etc/nginx/nginx.conf \
 --error-log-path=/var/log/nginx/error.log \
 --http-log-path=/var/log/nginx/access.log \
 --pid-path=/var/run/nginx/nginx.pid \
 --lock-path=/var/lock/nginx.lock \
 --user=nginx \
 --group=nginx \
 --with-http_ssl_module \
 --with-http_flv_module \
 --with-http_stub_status_module \
 --with-http_gzip_static_module \
 --http-client-body-temp-path=/var/tmp/nginx/client/ \  
 --http-proxy-temp-path=/var/tmp/nginx/proxy/ \
 --http-fastcgi-temp-path=/var/tmp/nginx/fcgi/ \
 --with-pcre
 
12.make&&make install
 
13.mkdir -pv /var/tmp/nginx/client
14 .nginx
15 vim /etc/nginx/nginx.conf
启用如下选项
location ~ \.php$ {
root html;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
include fastcgi_params;
}
添加php格式的主页,类似如下:
location / {
root html;
index index.php index.html index.htm;
}
16.编辑/etc/nginx/fastcgi_params,将其内容更改为如下内容:
fastcgi_param GATEWAY_INTERFACE CGI/1.1;
fastcgi_param SERVER_SOFTWARE nginx;
fastcgi_param QUERY_STRING $query_string;
fastcgi_param REQUEST_METHOD $request_method;
fastcgi_param CONTENT_TYPE $content_type;
fastcgi_param CONTENT_LENGTH $content_length;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
fastcgi_param REQUEST_URI $request_uri;
fastcgi_param DOCUMENT_URI $document_uri;
fastcgi_param DOCUMENT_ROOT $document_root;
fastcgi_param SERVER_PROTOCOL $server_protocol;
fastcgi_param REMOTE_ADDR $remote_addr;
fastcgi_param REMOTE_PORT $remote_port;
fastcgi_param SERVER_ADDR $server_addr;
fastcgi_param SERVER_PORT $server_port;
fastcgi_param SERVER_NAME $server_name;
17. pkill -1 nginx
18.测试
 
 

 

 

 

 

二.编译安装php-5.3.10

解决依赖关系:

请配置好yum源(可以是本地系统光盘)后执行如下命令:

# yum -y groupinstall "X Software Development"

# yum -y groupinstall "Development Tools" #安装好开发组包工具

# yum -y groupinstall "Development Libraries"# 安装编译时依赖的库文件

1.tar -jvxf php-5.3.10.tar.bz2  -C /usr/src
2.cd /usr/src/php-5.3.10
3../configure \
--prefix=/usr/local/php \
--with-mysql=/usr/local/mysql \
--with-openssl \
--enable-fpm  \
--enable-sockets \
--enable-sysvshm \
--with-mysqli=/usr/local/mysql/bin/mysql_config \
--enable-mbstring \
--with-freetype-dir \
--with-jpeg-dir \
--with-png-dir \
--with-zlib-dir \
--with-libxml-dir=/usr \
--enable-xml \
--with-config-file-path=/etc/php \
--with-config-file-scan-dir=/etc/php \
--with-bz2 \
--with-curl
4.make&&make install
5.为php提供配置文件
mkdir  /etc/php/
cp php.ini-production /etc/php/php.ini
6.测试
 

mysql

本文出自 “碧云天” 博客,转载请与作者联系!

你可能感兴趣的:(职场,LNMP,休闲)