## 1、下载资源 ![](https://i.vgy.me/8EzaZJ.png) >[success] 下载地址:[http://nginx.org/en/download.html](http://nginx.org/en/download.html) 下载当自己目录当中 ``` tar -zxf nginx-1.11.3.tar.gz cd nginx-1.11.3 ``` ## 2、安装依赖 ``` sudo apt-get install build-essential sudo apt-get install libtool sudo apt-get install openssl sudo apt-get install libpcre3 libpcre3-dev sudo apt-get install zlib1g-dev ``` ## 3、配置,将nginx安装到/usr/local/ngnix目录 ``` ./configure --prefix=/usr/local/nginx ``` ## 4、编译 ``` make ``` >[danger] 如果有错误,请看这篇文章:[https://blog.csdn.net/u010889616/article/details/82867091](https://blog.csdn.net/u010889616/article/details/82867091) ## 5、安装 ``` make install ``` ## 6、运行 ``` /usr/local/nginx/sbin/nginx ``` ![](https://i.vgy.me/BkgEru.png) ## File not found ``` 安装好了php-fpm,访问报错!这里就是我们nginx配置错误了 location ~ .php$ { fastcgi_pass 127.0.0.1:9000; fastcgi_index  index.php; fastcgi_param  SCRIPT_FILENAME /这里面改成自己源码目录$fastcgi_script_name; include fastcgi_params; } ```