Linux下的ngnix安裝與啓動

 Linux安裝Nginxlinux

1.安裝gcc gcc-c++(如新環境,未安裝請先安裝)
$ yum install -y gcc gcc-c++
2.安裝wget
$ yum -y install wgetnginx

3.安裝PCRE庫
$ cd /usr/local/
$ wget http://jaist.dl.sourceforge.net/project/pcre/pcre/8.33/pcre-8.33.tar.gz
$ tar -zxvf pcre-8.33.tar.gz
$ cd pcre-8.33
$ ./configure
$ make && make install
若是報錯:c++

在 linux 中執行 wget 命令提示 -bash: wget: command not found 解決方法
解決辦法 yum -y install wgetbash

4.安裝SSL庫
$ cd /usr/local/
$ wget http://www.openssl.org/source/openssl-1.0.1j.tar.gz
$ tar -zxvf openssl-1.0.1j.tar.gz
$ cd openssl-1.0.1j
$ ./config
$ make && make install.net

5.安裝zlib庫存進程

$ cd /usr/local/
$ wget http://zlib.net/zlib-1.2.11.tar.gz
$ tar -zxvf zlib-1.2.11.tar.gz
$ cd zlib-1.2.11
$ ./configure
$ make && make installssl

6.安裝nginx
$ cd /usr/local/
$ wget http://nginx.org/download/nginx-1.8.0.tar.gz
$ tar -zxvf nginx-1.8.0.tar.gz
$ cd nginx-1.8.0
$ ./configure
$ make && make installget

7.啓動nginx
啓動:/usr/local/nginx/sbin/nginx
查看進程:ps -aux | grep 'nginx'openssl

啓動方式還有:找到nginx.conf 文件   個人安裝目錄是  /usr/local/nginx/conf/nginx.confgcc

啓動:在sbin 下執行:./nginx -c /usr/local/nginx/conf/nginx.conf  

配置文件修改以後從新加載:  在sbin 下執行:   ./nginx -s reload

中止:在sbin 下執行:   ./nginx -s stop

相關文章
相關標籤/搜索