centos7编译安装nginx的方法步骤
安装nginx编译所需的lib库
yum-yinstallmakezlibzlib-develgcc-c++libtoolopensslopenssl-devel yum-yinstallpcrepcre-devel
查看pcre(正则库)版本
pcre-config--version
进入编译目录
cd/usr/local/src
从官网下载最新的nginx(stableversion稳定版)
wgethttp://nginx.org/download/nginx-1.14.0.tar.gz
解压nginx压缩包
tar-zxvfnginx-1.14.0.tar.gz
进入解压目录
cdnginx-1.14.0
运行配置脚本(--prefix参数指定nginx安装的目录,默认安装在/usr/local/nginx)
./configure--prefix=/usr/local/nginx
编译安装nginx
make&&makeinstall
将nginx执行命令软链接到/usr/bin
ln-s/usr/local/nginx/sbin/nginx/usr/bin
启动nginx
nginx
设置开机自启动
echo"/usr/local/nginx/sbin/nginx">>/etc/rc.d/rc.local chmod+x/etc/rc.d/rc.local
以上就是整个安装过程...
执行nginx-h查看相关命令
[root@localhost~]#nginx-h nginxversion:nginx/1.14.0 Usage:nginx[-?hvVtTq][-ssignal][-cfilename][-pprefix][-gdirectives] Options: -?,-h:thishelp -v:showversionandexit -V:showversionandconfigureoptionsthenexit -t:testconfigurationandexit -T:testconfiguration,dumpitandexit -q:suppressnon-errormessagesduringconfigurationtesting -ssignal:sendsignaltoamasterprocess:stop,quit,reopen,reload -pprefix:setprefixpath(default:/usr/local/nginx/) -cfilename:setconfigurationfile(default:conf/nginx.conf) -gdirectives:setglobaldirectivesoutofconfigurationfile
查看nginx安装目录
whereisnginx
以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持毛票票。