LNMP
Posted 冥想心灵
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了LNMP相关的知识,希望对你有一定的参考价值。
[[email protected] tools]# cat /etc/centos-release
CentOS release 6.7 (Final)
[[email protected] tools]# uname -r
2.6.32-573.el6.x86_64
[[email protected] tools]# rpm -qa pcre pcre-devel gcc gcc-c++
pcre-7.8-7.el6.x86_64
[[email protected] tools]# yum -y install pcre-devel pcre
[[email protected] tools]# rpm -qa openssl openssl-devel
openssl-1.0.1e-42.el6.x86_64
[[email protected] tools]# yum install -y openssl openssl-devel
mkdir -p /home/tools
cd /home/tools
wget -q http://nginx.org/download/nginx-1.12.0.tar.gz
[[email protected] tools]# useradd nginx -s /sbin/nologin -M
[[email protected] tools]# tar xf nginx-1.12.0.tar.gz
cd nginx-1.12.0
[[email protected] nginx-1.12.0]# ./configure --user=nginx --group=nginx --prefix=/application/nginx-1.12.0/ --with-http_stub_status_module --with-http_ssl_module
[[email protected] nginx-1.12.0]# ./configure --help
make
make install
[[email protected] nginx-1.12.0]# ln -s /application/nginx-1.12.0/ /application/nginx
[[email protected] nginx-1.12.0]# ll /application/nginx
lrwxrwxrwx. 1 root root 26 May 8 16:31 /application/nginx -> /application/nginx-1.12.0/
[[email protected] nginx-1.12.0]# /application/nginx/sbin/nginx -t
nginx: the configuration file /application/nginx-1.12.0//conf/nginx.conf syntax is ok
nginx: configuration file /application/nginx-1.12.0//conf/nginx.conf test is successful
[[email protected] nginx-1.12.0]# /application/nginx/sbin/nginx
[[email protected] nginx-1.12.0]# netstat -anptu | grep 80
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 4359/nginx
[[email protected] nginx-1.12.0]# wget 127.0.0.1 或者 [[email protected] nginx-1.12.0]# curl 127.0.0.1
sed -i ‘s/SELINUX=enforcing/SELINUX=disabled/‘ /etc/selinux/config
grep ‘SELINUX=disabled‘ /etc/selinux/config
setenforce 0
getenforce
vim /etc/rc.d/rc.local 开机自启
mkdir html/www -p
252 echo "http://www.etiantian.org" > html/www/index.html
253 cat html/www/index.html
257 egrep -v ‘#|^$‘ conf/nginx.conf.default > conf/nginx.conf
258 vim conf/nginx.conf
259 sbin/nginx -t
260 sbin/nginx -s reload
worker_processes 1;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
server {
listen 80;
server_name localhost;
location / {
root html;
index index.html index.htm;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}
server {
listen 80;
server_name www.etiantian.org;
location / {
root html/www;
index index.html index.htm;
}
}
}
~
以上是关于LNMP的主要内容,如果未能解决你的问题,请参考以下文章