I have always said on the Internet that Nginx has the performance advantage in handling high connections, so I hope to try it out. Here we will talk about how to install the Nginx service in Ubuntu. 1. During mysqlsudoapt-getinstallmysql-servermysql-client installation, enter the password of the root user. 2. Install nginxsudoapt-getinstallnginx3. Install
I have always said on the Internet that Nginx has the performance advantage in handling high connections, so I hope to try it out.
Here we will talk about how to install the Nginx service in Ubuntu.
1. Install mysql
- Sudo apt-get install mysql-server mysql-client
Enter the root user password during installation.
2. Install nginx
- Sudo apt-get install nginx
3. After the installation is successful. Restart the nginx service.
- Sudo service nginx restart
After starting, we can access the following address. See if the nginx welcome page is available.
4. Here we use php5-fpm for our php parsing.
- Sudo apt-get install php5-fpm
5. Next, we need to modify the nginx site configuration.
Ngnix configuration files are stored in/etc/nginx/sites-availble/default
- Server {
- Listen 80; # listen for ipv4; this line is default and implied
- Listen [:]: 80 default ipv6only = on; # listen for ipv6
- Root/usr/share/nginx/www;
- Index. php index.html index.htm;
- # Make site accessible from http: // localhost/
- Server_name _;
- Location /{
- # First attempt to serve request as file, then
- # As directory, then fall back to index.html
- Try_files $ uri // index.html;
- }
- Location/doc {
- Root/usr/share;
- Autoindex on;
- Allow 127.0.0.1;
- Deny all;
- }
- # Error_page 404/404 .html;
- # Redirect server error pages to the static page/50x.html
- #
- Error_page 500 502 503 x.html;
- Location =/50x.html {
- Root/usr/share/nginx/www;
- }
- # Proxy the PHP scripts to Apache listening on 127.0.0.1: 80
- #
- # Location ~ \. Php $ {
- # Proxy_pass http: // 127.0.0.1;
- #}
- # Pass the PHP scripts to FastCGI server listening on Fig: 9000
- #
- Location ~ \. Php $ {
- Try_files $ uri = 404;
- Fastcgi_pass 127.0.0.1: 9000;
- Fastcgi_index index. php;
- Include fastcgi_params;
- }
- # Deny access to. htaccess files, if Apache's document root
- # Concurs with nginx's one
- #
- Location ~ /\. Ht {
- Deny all;
- }
- }
Added some php parsing code.
6. install some components related to php5.
- Sudo apt-cache search php5
- Apt-get install php5-mysql php5-curl php5-gd php5-intl php5-imagick php5-imap php5-mcrypt php5-memcache php5-ming php5-ps php5-pspell php5-recode php5-snmp
7. Restart the service
- Sudo service php5-fpm restart
- Sudo service nginx
8. Try writing a probe file. Haha.