linux编译安装nginx
1.到官网(nginx)下载nginx压缩包:
2.以(nginx-1.24.0.tar.gz)为例:
1.上传压缩包至linux服务器:
rz
2.解压压缩包nginx-1.24.0.tar.gz:
tar -zxvf nginx-1.24.0.tar.gz
3.在安装Nginx之前,需要安装一些Nginx的依赖程序,Nginx的主要依赖程序有zlib、pcre、openssl三个,其中,zlib用于支 持gzip模块,pcre用于支持rewrite模块,openssl用于支持ssl功能,为了简单快捷,推荐通过yum安装zlib、pcre、openssl 软件包,安装方式如下:
yum -y install zlib pcre pcre-devel openssl openssl-devel
4. 源码编译安装Nginx
cd nginx-1.24.0
./configure \--prefix=/usr/local/nginx \--sbin-path=/usr/local/nginx/sbin/nginx \--conf-path=/usr/local/nginx/conf/nginx.conf \--error-log-path=/usr/local/nginx/logs/error.log \--http-log-path=/usr/local/nginx/logs/access.log \--pid-path=/usr/local/nginx/logs/nginx.pid \--with-http_stub_status_module \--with-http_ssl_module \--with-http_gzip_static_module \--with-pcre
--prefix:安装的位置
--sbin-path:启动位置
--conf-path:配置文件位置
make
make install
3.安装完成后启动nginx在自己window访问虚拟机80端口:
出现以下界面即代表安装完成: