Overview
Nginx ("Engine X") is a high-performance HTTP and reverse proxy server, also a IMAP/POP3/SMTP proxy server. Nginx has the advantage of being able to handle a large number of static page requests with low memory efficiency.
You can refer to the following: three major web server comparison analysis (Apache, Lighttpd,nginx)
PHP-FPM is a patch written for the PHP kernel to handle the start, stop, and restart of fastcgi processes as needed. A bit is:
- Low memory usage (because Nginx does not load the entire PHP environment when running alone).
- Easily manage user permissions (because PHP can manage different users in your server process).
- When PHP crashes, Nginx can run as usual.
NGINX+PHP-FPM can use less memory than apache+php_mod, carrying a high load.
installation
Installation of 1.nginx
wget Http://nginx.org/keys/nginx_signing.key
Apt-key Add Nginx_signing.key
echo "Deb http://nginx.org/packages/ubuntu/ trusty nginx" >>/etc/apt/sources.list
echo "Deb-src http://nginx.org/packages/ubuntu/ trusty nginx" >>/etc/apt/sources.list
Depending on the version of Ubuntu, Trusty will be replaced by other
Apt-get Update
Apt-get Install Nginx
If you have any questions, please refer to the official website documentation: Nginx installation method
The installation process encountered a problem
Chown:invalid group: ' Nginx:adm ', means no group ADM,Groupadd adm after apt-get install Nginx
Installation of 2.PHP-FPM
Apt-get Install PHP5-FPM
Netstat-anop
Indicates that the installed Nginx and PHP-FPM have been started
3. Modify Nginx and PHP-FPM configuration
Reference Zhang Daniel written Nginx 0.8.x + PHP 5.2.13 (FastCGI) build 10 times times more than Apache Web Server (6th edition)
Restart PHP-FPM and Nginx after configuration modification
Service PHP5-FPM Reload
Service Nginx Reload
Service PHP5-FPM Reload failed, so I ps-aux | grep PHP finds the PHP5-FPM process number, kills it, and then service PHP5-FPM start restarts FPM
After modifying the Nginx configuration, restart the error
Nginx: [Warn] the "log_format" directive May is used only on "HTTP" level in/etc/nginx/nginx.conf:84
"Log_format" misplaced location should not be placed on the server node, should be placed in the HTTP node, adjusted to restart the good
Installation of 4.mysql
Like Nginx and PHP5-FPM, the process is relatively smooth, not much talk
Deployment Blog
Download Onethink Source Package
wget http://down.thinkphp.cn/onethink.php?key= Mtqwmzc1odu3olvbf3ywzzmryhtsnb6p3nuuo3pzsarp3lkcy6uypa2nrcusoikgf6laiighst2qmrqqimmxym6bxot0nbf8gkfgz4tnlxmhq8dla62wzaflr O2d2ldlet6xoaokyhx_pk3pe66xea2mv2z5zcw6ntq5fguxxll6zr2eche
MV onethink.php?* Onethink.zip
Unzip Onethink.zip
Cp-r wwwroot/*/var/www/html
Visit http://hostname/install.php Follow the steps to deploy a good blog
pressure test
Server configuration approximately Digitalocean vps,512m memory, stress test indicates that 800 concurrent can process 1888 requests per minute, 30 requests will fail
Also check server memory and CPU consumption, OK
Command reference:
- Know the installation package name and view the files after installation
Dpkg-l <package>
- Want to know some installation package information
Dpkg-l Package-name-pattern
For example, want to know PHP related software
Dpkg-l php*
- Want to know which installation package the file belongs to
Dpkg-s Filename-search-pattern
- Want to know if a specific installation package is installed
Dpkg-s <package>
Reference reading: