1.下载最新版的nginx
http://nginx.org/
2.设置configure
[root@BmccEoms188 nginx-1.15.2]# ./configure --sbin-path=/eoms/nginx --conf-path=/eoms/nginx/conf/nginx.conf --pid-path=/eoms/nginx/sbin/nginx.pid --with-http_ssl_module
-bash: ./configure: Permission denied
You have mail in /var/spool/mail/root
[root@BmccEoms188 nginx-1.15.2]# cd ../
[root@BmccEoms188 server]# chmod -R 755 nginx-1.15.2/
[root@BmccEoms188 server]# cd nginx-1.15.2/
[root@BmccEoms188 nginx-1.15.2]# ./configure --sbin-path=/eoms/nginx --prefix=/eoms/nginx --conf-path=/eoms/nginx/conf/nginx.conf --pid-path=/eoms/nginx/sbin/nginx.pid --with-http_ssl_module --http-client-body-temp-path=/eoms/nginx/temp/client_body_temp --http-proxy-temp-path=/eoms/nginx/temp/proxy_temp --http-fastcgi-temp-path=/eoms/nginx/temp/fastcgi_temp
checking for OS
+ Linux 2.6.32-431.el6.x86_64 x86_64
checking for C compiler ... not found
./configure: error: C compiler cc is not found
[root@BmccEoms188 nginx-1.15.2]# yum -y install gcc
Loaded plugins: product-id, security, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
Setting up Install Process
No package gcc available.
Error: Nothing to do
[root@BmccEoms188 nginx-1.15.2]# ls /etc/yum.repos.d/
rhel-source.repo
You have mail in /var/spool/mail/root
[root@BmccEoms188 nginx-1.15.2]# vim /etc/yum.repos.d/rhel-source.repo
You have mail in /var/spool/mail/root
[root@BmccEoms188 nginx-1.15.2]# cd /etc/yum.repos.d/
[root@BmccEoms188 yum.repos.d]# vim RHEL.repo
[root@BmccEoms188 yum.repos.d]# yum -y install gcc
Loaded plugins: product-id, security, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
File contains no section headers.
file: file://///etc/yum.repos.d/RHEL.repo, line: 1
'me=rhel6\n'
[root@BmccEoms188 yum.repos.d]# vim RHEL.repo
You have mail in /var/spool/mail/root
[root@BmccEoms188 yum.repos.d]# yum -y install gcc
提示yum源无法使用,可以重新指定下yum源
RHEL.repo配置如下,根据自己情况修改yum源:
#############################
[rhel6]
name=rhel6
baseurl=ftp://10.4.65.104/pub/rhel6
enabled=1
gpgcheck=0
##############################
安装前置软件主要是以下几个:
yum -y install gcc
yum -y install gcc-c++
yum install make
yum -y install pcre-devel
yum install -y zlib-devel
yum -y install openssl openssl-devel
插件装完后继续在nginx安装目录执行configure,注意后面的path是nginx的安装后目录和配置目录,根据自己情况修改
./configure --sbin-path=/eoms/nginx --prefix=/eoms/nginx --conf-path=/eoms/nginx/conf/nginx.conf --pid-path=/eoms/nginx/sbin/nginx.pid --with-http_ssl_module --http-client-body-temp-path=/eoms/nginx/temp/client_body_temp --http-proxy-temp-path=/eoms/nginx/temp/proxy_temp --http-fastcgi-temp-path=/eoms/nginx/temp/fastcgi_temp --with-http_stub_status_module --with-http_ssl_module --with-http_realip_module
3.没异常后执行安装命令
make && make install
装完没提示[error]这样的就算好了,可以切换到安装好的目录/eoms/nginx使用命令检查下
[root@BmccEoms188 nginx]# ./nginx -t
nginx: the configuration file /eoms/nginx/conf/nginx.conf syntax is ok
nginx: configuration file /eoms/nginx/conf/nginx.conf test is successful
4.配置文件没问题就可以直接启动了
[root@BmccEoms188 nginx]# ./nginx -c /eoms/nginx/conf/nginx.conf
[root@BmccEoms188 nginx]# ps -ef|grep nginx
root 91858 1 0 11:30 ? 00:00:00 nginx: master process ./nginx -c /eoms/nginx/conf/nginx.conf
root 91859 91858 0 11:30 ? 00:00:00 nginx: worker process
root 91866 81906 0 11:30 pts/0 00:00:00 grep nginx
如何配置可以网上找一些参考,就不在这写了