优秀的编程知识分享平台

网站首页 > 技术文章 正文

LNMP环境搭建-nginx(lnmp环境搭建有什么用)

nanyue 2024-08-07 18:51:24 技术文章 9 ℃

搭建开胃菜

本次搭建都是个人自己理解进行的操作,如在搭建过程中存在疑问,请留言

使用的软件版本

nginx-1.4.2.tar.gz

mysql-5.6.13.tar.gz

php-5.4.17.tar.gz

1 安装依赖包 (考虑不在这里出发 不执行下面语句 留到以后用)

[sourcecode language="plain"]

yum -y install gcc pcre pcre-devel gcc-c++ autoconf libxml2

libxml2-devel zlib zlib-devel glibc libjepg libjepg-devel

libpng libpng-devel glibc-devel glib2 glib2-devel ncurses

ncurses-devel curl curl-devel e2fsprogs e2fsprogs-devel

openssl openssl-devel openldap openldap-devel nss_ldap

openldap-clients openldap-servers make

[/sourcecode]

2.安装nginx

自行创建一个用户和用户组分配给nginx

[sourcecode language="plain"]

groupadd -r nginx

useradd -r -g nginx -s /bin/false -M nginx

[/sourcecode]

[sourcecode language="plain"]

// 安装一个yum 源包 如果不行 先下载

rpm -ivh <span style="font-family: Consolas,Bitstream Vera Sans Mono,Courier New,Courier,monospace;"><a href="http://packages.sw.be/rpmforge-release/rpmforge-release-0.5.3-1.el6.rf.x86_64.rpm">http://packages.sw.be/rpmforge-release/rpmforge-release-0.5.3-1.el6.rf.x86_64.rpm</a>(适用 </span>geoip geoip-devel)

yum install pcre pcre-devel openssl openssl-devel libxslt-devel gd-devel geoip geoip-devel

./configure --prefix=/usr/local/nginx-1.4.2 --with-http_ssl_module --with-http_realip_module --with-http_sub_module --with-http_mp4_module --with-http_gzip_static_module --with-http_gunzip_module --with-http_stub_status_module --with-http_ssl_module --with-http_spdy_module --with-http_addition_module --with-http_xslt_module --with-http_image_filter_module --with-http_geoip_module --with-http_dav_module --with-http_flv_module --with-http_random_index_module --with-http_secure_link_module --with-http_degradation_module

make && make install

[/sourcecode]

顺利到达此处表示nginx已经安装完毕,下面配置nginx相关信息

配置nginx快速启动

nginx启动文件下载地址http://7xsaxb.dl1.z0.glb.clouddn.com/nginx

把下载nginx 拷贝到/etc/init.d 目录下

[sourcecode language="plain"]

chmod +x /etc/init.d/nginx

chkconfig --add nginx

chkconfig nginx on

service nginx restart (重启有一个关闭的过程,在关闭之后 请求会失败)

平滑启动

/usr/local/nginx/sbin/nginx -s reload(reload则不会影响请求)

[/sourcecode]

如果启动正常 表示nginx 已经安装完毕

第一次写文章感觉还不是很适应,所以先写到这 后续mysql和php的安装会记录跟进,谢谢大家

原文地址:http://www.58maisui.com/2016/03/17/lnmp/

最近发表
标签列表