Configuration Environment Description: System: Ubuntu12.0432-Bit Memory: m Hard Disk: 20G 1. Install nginx1: ubuntu because of the security policy, the root user is generally disabled, therefore, sudo is usually required for each command execution. To perform other subsequent operations, you can first switch to the root user so that sudo does not need to be added each time. Sudosu & ndash; (switch user) 2: By default, ubuntu is the official source.
Configuration Environment Description:
System: Ubuntu 12.04 32-bit
Memory: 512 MB
Hard Disk: 20 GB
1. Install nginx
1: because of the security policy of ubuntu, the root user is usually disabled. Therefore, sudo is usually required for each command execution. To perform other subsequent operations, you can first switch to the root user so that sudo does not need to be added each time.
Sudo su-(switch user)
2: By default, ubuntu is the official source, which may be slow for domestic users. Therefore, we will change the official source to 163. The modification method is not described here, check the ubuntu wiki help manual.
3: after the source is modified, refresh the list:
Apt-get update
Install nginx now
There are many ways to install nginx. You can download the nginx source code package, compile and install it, or install it in the form of ubuntu software package. Consider the following factors:
1) if the system is compiled and installed through the source code, the system performance will be relatively high. In this case, it is better to install the software through the source code. If the system is installed in ubuntu and other release versions, the compilation of the software through the source code does not significantly improve the performance. Of course, if you want to exercise or be satisfied with yourself, you can also try to install it through the source code.
2) If you build an environment to test, learn, or build a small website, you are not advised to install it using the source code, source code installation methods may cause many problems, and also increase the difficulty of maintenance for small webmasters in the future.
3) The online package management mechanism supported by ubuntu is certainly very mature, and there is no need to worry about its stability and security.
4) Of course, the advantage of source code compilation is that customization is relatively high. So it depends on your needs.
Okay, you don't have to talk about it anymore.
4: Install nginx
Run the command: apt-get install nginx
5. Start nginx after installation. For Nginx 0.8.x and later versions, start, stop, and smoothly start nginx.
Enable the service:
/Etc/init. d/nginx start
There is also another way to enable the Service.
/Usr/sbin/nginx-c/etc/nginx. conf
The preceding is the nginx installation path.-c indicates the path of the nginx configuration file.
Stop Service
/Etc/init. d/nginx-s stop
Heavy Load
/Etc/init. d/nginx-s reload
After the nginx installation is complete, open the browser and access http: // localhost to check whether nginx is properly installed and started. If there are firewall restrictions, such as vps, you may not be able to directly access through ip addresses, but you need to configure domain names for access. The way nginx configures virtual hosts is described later.