One-click installation of Nginx

Source: Internet
Author: User
Tags zts vps filezilla filezilla host ioncube

One-click installation and upgrade of LNMP nginx and SFTP Management Guide for common php settings

For beginners who want to use Nginx as a web server.
There are two main aspects: first, the LNMP installation process, LNMP binding domain name, ngnix, php upgrades, and common 404 or 301 settings. Second, the VPS does not install FTP software, and uses the flashfxp sftp function to upload and manage files.
LNMP is the first choice for VPS website construction. The VPS used in this article is the US BurstNET company VPS. Its basic configuration is as follows:
CPU: 1 GB,
Memory: 512 M,
Hard Disk: 20 GB,
Traffic: 1000 GB/month,
Two IP addresses,
System: CentOS5.5 _ x86.
Domain names to bind: tkcz.net, askbar.net, cnvz.org, cbrcc.com

1. Install LNMP
Preparations
Uninstall the self-built apache server
Rpm-e httpd
Install LNMP
Install the tool according to the official website prompts. Because the VPS is in the United States, select the downloaded version: http://soft.vpser.net/lnmp/lnmp0.6.tar.gz.
Http://soft.vpser.net/lnmp/lnmp0.6.tar.gz wget-c
Tar zxvf lnmp0.6.tar.gz
Cd lnmp0.6
./Centos. sh can also be executed./centos. sh | tee lnmp. log (this server is CentOS5.5, if other systems execute the corresponding command)
Enter the domain name to bind,
Tkcz.net press ENTER
Enter the MYSQL root Account password you want to set. Remember this:
Press enter to prompt "Press any key to start...". Press any key to start installation. Under normal circumstances, the installation can be completed in about 20-40 minutes.


Upgrade the eAccelerator cache plug-in to php and then modify eaccelerator. sh to install it.
So far LNMP installation is complete, the default website directory is/home/wwwroot/, the default installation of PHPMYADMIN, you can use the http://tkcz.net/phpmyadmin/index.php to manage your MYSQL database.
For ease of management, change the website directory to/www/tkcz.net. The modification method is as follows:
Vim/usr/local/nginx/conf/nginx. conf
Find root/home/wwwroot
Change to root/www/tkcz.net
In addition, www.tkcz.net is added to server_name tkcz.net to enable simultaneous access of www.tkcz.net and tkcz.net.
That is, server_name tkcz.net www.tkcz.net;
Save and exit
Move PHPMYADMIN to the/www/tkcz.net directory
Mv-if/home/wwwroot/phpmyadmin/www/tkcz.net
Restart Nginx
/Root/lnmp reload

2. Upgrade Nginx and php
 

Wget soft.vpser.net/lnmp/upgrade_nginx.sh
Sh./upgrade_nginx.sh
Then follow the prompts to enter the Nginx version number to be upgraded. The Nginx version number can be queried from http://nginx.org/en/download.html.

Enter the latest version 0.9.7, and press enter again to confirm the installation. The upgrade is successful.
To Upgrade php, you must reinstall ionCube and install the latest version of eaccelerator.
Steps:
Wget http://soft.vpser.net/lnmp/upgrade_php.sh
Sh upgrade_php.sh

Note: You must enter the correct version number. Otherwise, the upgrade will fail! Enter 5.3.6 here (search from http://www.php.net website)

After the upgrade,/etc/init. d/php-fpm {start | stop | quit | restart | reload | logrotate} will be used for management.

Path to the php-fpm configuration file:/usr/local/php/etc/php-fpm.conf

Php configuration file path:/usr/local/php/etc/php. ini

Compile eaccelerator. sh
Vim eaccelerator. sh
Set the following content
Http://soft.vpser.net/web/eaccelerator/eaccelerator-0.9.5.3.tar.bz2 wget-c
Tar jxvf eaccelerator-0.9.5.3.tar.bz2
Cd eaccelerator-0.9.5.3/

Change

Http://bart.eaccelerator.net/source/0.9.6.1/eaccelerator-0.9.6.1.tar.bz2 wget-c
Tar jxvf eaccelerator-0.9.6.1.tar.bz2
Cd eaccelerator-0.9.6.1/
Another
Zend_extension = "/usr/local/php/lib/php/extensions/no-debug-non-zts-20060613/eaccelerator. so "-

Change
Zend_extension = "/usr/local/php/lib/php/extensions/no-debug-non-zts-20090626/eaccelerator. so"
Otherwise, the prompt "/usr/local/php/lib/php/extensions/no-debug-non-zts-20060613/" No folder appears when you run php-fpm.

Compile ionCube. sh
Vim ionCube. sh
Set
Zend_extension = "/usr/local/ioncube/ioncube_loader_lin_5.2.so" changed to zend_extension = "/usr/local/ioncube/ioncube_loader_lin_5.3.so"
Otherwise, Cannot load the ionCube PHP Loader-it was built with configuration 2.2.0, whereas running engine is API220090626
PHP 5.3.6 (fpm-fcgi) prompt.

Php5.3.6 ZentOptimizer is replaced by ZentGuardloader5.5. You can download ZentGuardloader. so (http://www.tkcz.net/uploads/uploads/ZentGuardloader.so) from this site to move to the/usr/local/zend/directory, if a file exists, overwrite it.

/Usr/local/php/sbin/php-fpm-v

Appears
PHP 5.3.6 (fpm-fcgi) (built: Apr 10 2011 09:38:05)
Copyright (c) 1997-2009 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2011 Zend Technologies
With eAccelerator v0.9.6.1, Copyright (c) 2004-2010 eAccelerator, by eAccelerator
With the ionCube PHP Loader v4.0.7, Copyright (c) 2002-2011, by ionCube Ltd., and
With Zend Guard Loader v3.3, Copyright (c) 1998-2010, by Zend Technologies
The upgrade is successful.
/Root/lnmp reload
Enter http://www.tkcz.net/p.php In the webpage address. Result

 


3. Bind the domain name to the directory

When LNMP is bound to a domain name, askbar.com and www.askbar.com must be entered separately. In the following example, the primary domain name is askbar.net, and www.askbar.net is bound together as other domain names. Command:

/Root/vhost. sh

1. For the bound primary domain name, enter askbar.net and press enter (in the figure, enter www.tkcz.net)
2. If you want to bind another domain name, enter y and press Enter.
3. Enter another domain name you want to bind, such as www.askbar.net, and press enter (in the figure, enter mysql.tkcz.net)
4. What is the bound directory of your website? The default value is/home/wwwroot/askbar.net, which can be customized. Enter/www/askbar.net here (input tkcz.net in the figure)
5. Ask if you want to enable pseudo-static rules. There are several built-in rules that you can enter as needed.
6. If you want to enable Log File n, press Enter.
After the domain name is bound by default, an askbar.net is generated under/usr/local/nginx/conf/vhost. conf file. To change the bound directory, modify the bound domain name or add rules 301 or 404.





Bind cnvz.org, www.cnvz.org, cbrcc.com, and www.cbrcc.com in the same way

If you have many domain names, you only need to back up the configuration files in the/usr/local/nginx/conf/vhost directory, reinstall the system, and then upload the files. If you want to delete the binding, you only need to delete the file. Load the configuration again:

/Root/lnmp reload

4. Customize the 404 error file

Find your site configuration file, such as/usr/local/nginx/conf/vhost/askbar.net. conf.

Add a line under root/www/askbar.net:
Error_page 404/404 .php;

 5. pseudo-static rules

The pseudo-static rules of nginx are different from those of apache. By default, lnmp contains some pseudo-static rules, such as discuz typecho wordpress, which can be enabled directly when a domain name is bound. However, if discuzX1.5 or phpwind is used, we need to modify it. It is actually very simple:

1. Save pseudo-static rules into a conf file, for example, phpwind. conf to/usr/local/nginx/conf.

2. Modify your domain name configuration file, such as/usr/local/nginx/conf/vhost/your.com. conf, and include phpwind. conf.

# After modifying the relevant settings, you need to use the following command to reload the configuration to make it take effect:
/Root/lnmp reload

Automatic domain name 301 pseudo-static rules:

If ($ host! = 'Www .tkcz.net ') {rewrite ^/(. *) $ http://www.tkcz.net/#1

Permanent ;}

None of other notes

6. Use SFTP to transfer files

If you use your own VPS, there is no need to waste memory to install FTP software. You only need to use the built-in SFTP to upload or download files. Two commonly used software, FLASHFXP and FILEZILLA, are as follows:

1. In the Flashfxp transmission type, SFTP and user name and password ports are used, all of which are the same as SSH.

 

 
 

2. Fill in your IP address for the FileZilla host, select SFTP for the server type, and set the user name and password to the same port as SSH.

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.