Nginx
一、介绍
二、安装编译环境
- 安装pcre,perl兼容正则表达式库,官网http://www.pcre.org
[root@localhost /]# yum install pcre* -y
或
[root@localhost /]# unzip pcre-8.10.zip [root@localhost /]# ./configure [root@localhost /]# make && make install
- 安装openssl,在使用HTTPS会用到。
[root@localhost /]# yum install openssl openssl-devel -y
三、安装Nginx
[root@localhost /]# ./configure \ --user=nginx \ --group=nginx \ --prefix=/apps/nginx1.11.3 \ --with-http_stub_status_module \ --with-http_ssl_module \ --with-pcre=/usr/local/pcre 如果是编译的方式安装pcre,需要添加这行参数 [root@localhost /]# make && make install [root@localhost /]# ln -s /apps/nginx1.11.3 /apps/nginx [root@localhost /]# useradd nginx -m -s /sbin/nologin
四、配置
创建网站文件
[root@localhost /]# mkdir -p /var/html/www [root@localhost /]# echo "www.7wlnk13.org" > /var/html/www/index.html
编辑nginx.conf配置文件
[root@localhost nginx]# vim /apps/nginx/conf/nginx.conf http { include mime.types; default_type application/octet-stream; sendfile on; keepalive_timeout 65; server { listen 80; server_name www.7wlnk13.org; root /var/html/www; index index.html index.htm; } }
六、启动
[root@localhost /]# /apps/nginx1.11.3/sbin/nginx -t nginx: the configuration file /apps/nginx1.11.3/conf/nginx.conf syntax is ok nginx: configuration file /apps/nginx1.11.3/conf/nginx.conf test is successful [root@localhost /]# /apps/nginx1.11.3/sbin/nginx
七、查看编译参数
[root@localhost /]# /apps/nginx1.11.3/sbin/nginx -V nginx version: nginx/1.11.3 built by gcc 4.4.7 20120313 (Red Hat 4.4.7-17) (GCC) built with OpenSSL 1.0.1e-fips 11 Feb 2013 TLS SNI support enabled configure arguments: --user=nginx --group=nginx --prefix=/apps/nginx1.11.3 --with-http_stub_status_module --with-http_ssl_module
没有帐号? 立即注册