第一步安装编译环境html
第二步下载你想要安装的nginx版本nginx
#wget http://nginx.org/download/nginx-版本号-tar.gzweb
而后解压进目录服务器
第三步 #日志
./configure --prefix=/usr/local/nginx --sbin-path=/usr/local/nginx/sbin/nginx --conf-path=/usr/local/nginx/conf/nginx.conf --error-log-path=/var/log/nginx/error.log --http-log-path=/var/log/nginx/access.log --pid-path=/var/run/nginx/nginx.pid --lock-path=/var/lock/nginx.lock --user=nginx --group=nginx --with-http_ssl_module --with-http_stub_status_module --with-http_gzip_static_module --http-client-body-temp-path=/var/tmp/nginx/client/ --http-proxy-temp-path=/var/tmp/nginx/proxy/ --http-fastcgi-temp-path=/var/tmp/nginx/fcgi/ --http-uwsgi-temp-path=/var/tmp/nginx/uwsgi --http-scgi-temp-path=/var/tmp/nginx/scgi --with-pcre
第四步make&&make installhtm
conf:保存nginx全部的配置文件,其中nginx.conf是nginx服务器的最核心最主要的配置文件,其余的.conf则是用来配置nginx相关的功能的,例如fastcgi功能使用的是fastcgi.conf和fastcgi_params两个文件,配置文件通常都有个样板配置文件,是文件名.default结尾,使用的使用将其复制为并将default去掉便可。
html目录中保存了nginx服务器的web文件,可是能够更改成其余目录保存web文件,另外还有一个50x的web文件是默认的错误页面提示页面。
logs:用来保存nginx服务器的访问日志错误日志等日志,logs目录能够放在其余路径,好比/var/logs/nginx里面。
sbin:保存nginx二进制启动脚本,能够接受不一样的参数以实现不一样的功能。进程
验证端口ip
#ps -ef | grep nginxssl
显示占用80端口的进程get
#lsof -i:80
查看nginx主进程
#cat /var/run/nginx/nginx.pid