How does Centos build CDN server through nginx reverse proxy and proxy_cache cache

  
                

Some company users need to set up a CDN server for their own websites. However, some specific configuration methods on the network can be configured basically, but they also contain some minor errors, such as syntax errors of configuration files. . Therefore, Xiaobian has reorganized the specific configuration method for setting up the CDN server for everyone. Let's take a look at the users who need it.

configuration:

1, WEB server

domain name: www.win8.net

IP: 61.188.87.100

2, Nginx reverse proxy server

IP: 192.168.190.128

Operating system: Centos

3, client

IP: 192.168. 190.1

Operating System: win7

C:\\Windows\\System32\\drivers\\etc\\hosts #Open with Notepad and add the following line at the end of the file

192.168.190.128 Www.win8.net

Configuration Steps--Nginx Reverse Proxy Server

1. Shut down SELinux

vi /etc/selinux/config#SELINUX=enforcing #Comment out #SELINUXTYPE=targeted #Comment SELENUX=disabled #增:wq #Save, close. Shutdown -r now #restart the system

2, the firewall opens port 80

vi /etc/sysconfig/iptables-A INPUT -m state --state NEW -m tcp -p tcp -- Dport 80 -j ACCEPT #Add content /etc/init.d/iptables restart # Restart the firewall to make the configuration effective

3, install the compiler

yum install wget make gcc gcc-c++ zlib- Devel openssl openssl-devel pcre-devel gd kernel keyutils patch perl

4, system conventions

Software source code package storage location: /usr/local/src source package compilation installation location: /usr /local/Software Name

5, Download Software

cd /usr/local/src #Enter the directory (1), download nginx (current stable version) wget http://nginx.org /download/nginx-1.8.0.tar.gz(2), download pcre (support nginx pseudo-static) wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.35 .tar.gz #This command I did not get the file, upload it to the server after downloading locally (2), download ngx_cache_purge (clear the specified URL cache) wget http://labs.frickle.com/files/Ngx_cache_purge-2.3.tar.gz

6. Install pcre

cd /usr/local/srcmkdir /usr/local/pcre #Create the installation directory tar zxvf pcre-8.35.tar.gzcd pcre -8.35./configure --prefix=/usr/local/pcre #configure makemake install

7. Install Nginx

groupadd www #addwww groupuseradd -g www www -s /bin /false #Create nginx run account www and join the www group, do not allow www users to log in directly to the system cd /usr/local/srctar zxvf ngx_cache_purge-2.3.tar.gztar zxvf nginx-1.8.0.tar.gzcd nginx-1.8. 0./configure --prefix=/usr/local/nginx --user=www --group=www --with-http_stub_status_module --with-openssl=/usr/--with-pcre=/usr/local/src /pcre-8.35 --add-module=../ngx_cache_purge-2.3 #Note: --with-pcre=/usr/local/src/pcre-8.35 points to the path to the source package decompression, not the path to install. Otherwise, you will get the error make #compile make install #install /usr/local/nginx/sbin/nginx #start nginxchown www.www -R /usr/local/nginx/html #set directory owner chmod 700 -R /usr/local/Nginx/html #Set directory permissions Previous123Next page Total 3 pages

Copyright © Windows knowledge All Rights Reserved