1.download Nginx Source
2.
TAR–XVF nginx.tar.gz
3.nginx requires prec and zlib libraries
sudo apt-get prec3 prec3-devsudo apt-get zlib1g Zlib1g-dev
4. Installation Configuration
CD Nginxsudo./configure
Installation content
configuration summary +using system pcre library +openssl library is not used +using builtin md5 code +sha1 Library is not found +using system zlib library nginx path prefix: "/usr/local/nginx" nginx binary file: "/usr/local/nginx/sbin/ Nginx " nginx configuration prefix: "/usr/local/nginx/conf " nginx configuration file: "/usr/local/nginx/conf/nginx.conf" nginx pid file: "/usr/local/nginx/logs /nginx.pid " nginx error log file: "/usr/local/nginx/logs/error.log " nginx http access log file: "/usr/local/nginx/logs/access.log" nginx http client request body temporary files: "Client_body_temp" nginx http proxy temporary files: "ProXy_temp " nginx http fastcgi temporary files: " Fastcgi_temp " nginx http uwsgi temporary files: "Uwsgi_temp" nginx http scgi temporary files: "Scgi_temp"
5. compiling the installation
sudo makesudo make install
after successful installation,Nginx placed in the/usr/local/nginx directory, the main configuration file is the Conf directory nginx.conf
6. configuration from /etc/init.d/nginx start
sudo wgethttps://raw.github.com/jasongiedymin/nginx-init-ubuntu/master/nginx-o/etc/init.d/nginxsudo chmod +x/etc/ Init.d/nginxsudo Vim/etc/init.d/nginx
Default Condition Consts below, if you are different from your own situation then adjust (red content is a common need to modify the adjustment of the item):
Path=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bindaemon=/usr/local/nginx/sbin/nginx ps= " Nginx "Pidname=" #lets you do $PS-slavepidfile= $PIDNAME .pid #pid filepidspath=/usr/local/nginx/logs #default pidlocation, you Should change it description= "Nginx server ..." RUNAS=root #user to run as SCRIPT_OK=0 #ala error codesscript_error=1 #ala error codesTRUE=1 #booleanFALSE =0 #boolean lockfile=/var/lock/subsys/nginxnginx_conf_file= "/usr/local/nginx/conf/nginx.conf" # chkconfig –add nginx# chkconfig –level 2345 nginx on
So, the way to start Nginx is
sudo service nginx Startsudo/etc/init.d/nginx start
The method for setting up boot is:
# vim/etc/rc.local
Write
Service Nginx Start
before if rc.local inside have /usr/local/nginx/sbin/nginx of Remember to erase (nonsense =)
7. Installing PHP-FPM
sudo apt-getinstall php5-fpm
add in /usr/local/nginx/conf/fastcgi_params
Fastcgi_param script_filename $document _root$fastcgi_script_name;
add in /usr/local/nginx/conf/nginx.conf
Gzip on;gzip_min_length 1k;gzip_buffers 4 16k;gzip_http_version 1.1;gzip_comp_level 2;gzip_types text/plain applicatio N/x-javascript text/cssapplication/xml;gzip_vary on; # Pass the PHP scripts to FastCGI serverlistening on 127.0.0.1:9000#location ~ \.php$ {root Html;fastcgi_pass 127.0.0.1:9000;fastcgi_index Index.php;fastcgi_param script_filename/scripts$fastcgi_script_name;include FASTCG I_params;}
8. Listening Port
Configuring The PHP5 listening port
/etc/php5/fpm/pool.d/www.conf
change listen =/var/run/php5-fpm.sock to listen = 127.0.0.1:9000
re-running the PHP process
9. Testing
<?phpphpinfo ();? >
This article is from the "Xyw's Data Station" blog, so be sure to keep this source http://xyw55.blog.51cto.com/8191121/1660918
Install NGINX1.8.0+PHP5-FPM on ubuntu14.04