目录
1.搭建Nginx服务器
环境如下:
使用2台RHEL7 虚拟机,其中一台作为Nginx服务器(192.168.4.5)、另外一台作为测试用的Linux客户机(192.168.4.100),如图-1所示。
安装nginx-1.8.0版本时,需要使用如下参数:
with-http_ssl_module:提供SSL加密功能
user:指定账户
group:指定组
步骤一:构建Nginx服务器
1)使用源码包安装nginx软件包
[root@svr5 ~]# yum –y install gcc pcre-devel openssl-devel //安装常见依赖包
[root@svr5 ~]# useradd –s /sbin/nologin nginx
[root@svr5 ~]# tar -xf nginx-1.8.0.tar.gz
[root@svr5 ~]# cd nginx-1.8.0
[root@svr5 nginx-1.8.0]# ./configure \
> --prefix=/usr/local/nginx \ //指定安装路径
> --user=nginx \ //指定用户
> --group=nginx \ //指定组
> --with-http_ssl_module //开启SSL加密功能
.. ..
nginx path prefix: “/usr/local/nginx”
nginx binary file: “/usr/local/nginx/sbin/nginx”
nginx configuration prefix: “/usr/local/nginx/conf”
nginx configuration file: “/usr/local/nginx/conf/nginx.conf”
nginx pid file: “/usr/local/nginx/logs/nginx.pid”
nginx error log file: “/usr/local/nginx/logs/error.log”
nginx http access log file: “/usr/local/nginx/logs/access.log”
nginx http client request body temporary files: “client_body_temp”
nginx http proxy temporary files: “proxy_temp”
nginx http fastcgi temporary files: “fastcgi_temp”
nginx http uwsgi temporary files: “uwsgi_temp”
nginx http scgi temporary files: “scgi_temp”
[root@svr5 nginx-1.7.10]# make && make install //编译并安装
2)nginx命令的用法
[root@svr5 ~]# /usr/local/nginx/sbin/nginx
//启动服务
[root@svr5 ~]# /usr/local/nginx/sbin/nginx -s stop
//关闭服务
[root@svr5 ~]# /usr/local/nginx/sbin/nginx -s reload
//重新加载配置文件
[root@svr5 ~]# /usr/local/nginx/sbin/nginx –V
//查看软件信息
nginx服务默认通过TCP 80端口监听客户端请求: