Recent long time did not write a blog, is a major lack of time to get home are close to 11 pm every day, but after a day or guarantee an essay. Good for finishing summarize their knowledge.
web server and more useful example: Apache nginx tengine lighttpd Tomcat Websphere Jboss IIS, etc., summarizes today is nginx
nginx is used extensively in this country, such as Taobao not use nginx also use the experience thus still above nginx launched Tengine.
A. Install nginx
Premise: All machines have been configured yum source.
First set up two web servers using the ip address for the network card eth1 respectively 192.168.2.100/24 192.168.2.200/24
nmcli connection modify eth1 ipv4.method manual ipv4.addresses '192.168.2.100/24' connection.autoconnect yes
nmcli connection up eth1
Modify the hostname
hostnamectl set-hostname web1
hostnamectl set-hostname web2
Modifies the hosts file to resolve
cat >>/etc/hosts<<EOF
> 192.168.2.100 web1
> 192.168.2.200 web2
> EOF
The installation requires the installation of dependencies basic components: gcc pcre-devel openssl-devel
gcc: C language interpreter, is responsible for compiling the source code into binary executable files
pcre-devel: Regular expression dependent
openssl-devel: ssl support such encryption dependence, nginx by itself does not support encryption allowed to call this dependency support encryption
yum install -y gcc pcre-devel openssl-devel
For security, users manually add nginx and let nginx nginx program to start as a user, the user can check the identity of limited authority, can not be allowed to operate other files, and let not log on.
useradd -s /sbin/nologin nginx
File after decompression into the decompression folder nginx ready to start configuring compile and install
Translation parameters: --prefix = specify the installation directory --user = nginx --group = nginx nginx specified user group nginx run --with-http_ssl_module the ssl encryption module turns ssl
./configure --prefix=/usr/local/nginx --user=nginx --group=nginx --with-http_ssl_module
After you configure this prompted a summary compiled, then the configuration finished.
Configuration summary
+ using system PCRE library
+ using system OpenSSL library
+ using system zlib library
Compile and build and install
make && make install
After installation you can see directories under / usr / local / nginx
conf: nginx configuration file
html: the default storage directory page file
logs: Logs
sbin: The main program
nginx services commonly used commands
./nginx start the service
./nginx -s stop service shut down
./nginx -s reload to reload the configuration file
./nginx -V View software information
ln -s nginx / sbin / sbin create a soft link in the directory can only use nginx command