Linux服务器部署Website全过程,使用Nginx实现反向代理
[[email protected] /]# yum install pcre-devel zlib zlib-devel openssl openssl-devel
作用:让 Nginx 支持 Rewrite 功能
1.下载pcre安装包
[[email protected] ~]# cd /usr/local/src/
[[email protected] src]# wget http://downloads.sourceforge.net/project/pcre/pcre/8.35/pcre-8.35.tar.gz
2. 解压安装包:
[[email protected] src]# tar zxvf pcre-8.35.tar.gz
3. 进入安装包目录
[[email protected] src]# cd pcre-8.35
4.编译安装
[[email protected] pcre-8.35]# ./configure
[[email protected] pcre-8.35]# make && make install
5.查看pcre版本
1.下载Nginx
[[email protected] src]# wget http://nginx.org/download/nginx-1.6.2.tar.gz
2.解压安装包
[[email protected] src]# tar zxvf nginx-1.6.2.tar.gz
3.进入安装目录
[[email protected] src]# cd nginx-1.6.2
4.编译安装
[[email protected] nginx-1.6.2]# ./configure --prefix=/usr/local/webserver/nginx --with-http_stub_status_module --with-http_ssl_module --with-pcre=/usr/local/src/pcre-8.35
[[email protected] nginx-1.6.2]#make && make install
5.查看nginx版本
[[email protected] nginx-1.6.2]# /usr/local/webserver/nginx/sbin/nginx -v
1. 创建 Nginx 运行使用的用户 www:
[[email protected] nginx-1.6.2]# /usr/sbin/groupadd www
[[email protected] nginx-1.6.2]# /usr/sbin/useradd -g www www
2. 配置nginx.conf ,将/usr/local/webserver/nginx/conf/nginx.conf内容替换
检查配置文件nginx.conf的正确性命令:
[[email protected] conf]# /usr/local/webserver/nginx/sbin/nginx -t
3.启动Nginx
[[email protected] conf]# /usr/local/webserver/nginx/sbin/nginx
把打包后的web文件上传至nginx html目录下