nginx is a high performance web server and it is also a strong reverse proxy server. We just need to download the source code to compile and install the configuration.
First, install Nginx1, install the required PCRE library:
cd /tmpwget -c ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre /pcre-8.13.tar.gztar -zxvf pcre-8.13.tar.gzcd pcre-8.13./configure --prefix=/usrmakemake install
2, download nginx source installation:
cd /tmpwget -c http://nginx.org/download/nginx-1.0.8.tar.gztar -zxvf nginx-1.0.8.tar.gzcd nginx-1.0.8./configure --user=nginx --group =nginx --prefix=/usr/local/nginx --with-http_addition_module --with-http_perl_module --with-http_flv_module --with-http_gzip_static_module --with-http_realip_module --with-http_ssl_module --with-http_stub_status_module --with -http_sub_module --with-http_dav_modulemakemake install
3, create nginx user:
useradd nginx -s /sbin/nologin -M
4, the following is displayed after installation Some installation paths: nginx path prefix: "/usr/local/nginx"nginx binary file: "/usr/local/nginx/sbin/nginx"nginx configuration prefix: "/usr/local/nginx/conf"nginx Configuration fil e: "/usr/local/nginx/conf/nginx.conf"nginx pid file: "/usr/local/nginx/logs/nginx.pid"nginx error log file: "/usr/local/nginx/Logs/error.log"nginx http access log file: "/usr/local/nginx/logs/access.log"nginx http client request body temporary files: "client_body_temp"nginx http proxy temporary files: "proxy_temp"nginx Http fastcgi temporary files: "fastcgi_temp"nginx http uwsgi temporary files: "uwsgi_temp"nginx http scgi temporary files: "scgi_temp"
Second, configure nginx1, edit configuration file /usr/local/nginx/Conf/nginx.conf
vim /usr/local/nginx/conf/nginx.conf
2, modify the following to remove the # before the first line, to:
user nginx nginx;
Change worker_processes to 2,
worker_processes 2;
Remove # before the following two lines:
error_log logs/error.logpid logs/nginx.pid
Binding the domain name or IP used instead:
listen 80;server_name tied Domain name or IP;
3, configure the reverse proxy content, and replace the URL with HttpSubModule: find location /{root html; index index.html index.htm; add after:
Sub_filter The domain name or IP to be reversed by the proxy's URL; #换URLsub_filter_once off; #Search replace all lines proxy_pass http://reverse proxy URL; proxy_set_header X-Real-IP $remote_addr;proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;proxy_set_header Accept-Encoding ""; #清编码
3, write nginx startup script, set boot self-start:
vim /etc/init.d/nginx
Startup script content see here
chmod 755 /etc/init.d/nginxchkconfig --level 345 nginx on
4, test reverse proxy browser input reverse proxy Domain name or IP, view can open normally, URL is replaced.
Currently, a very serious Bash vulnerability has been exposed on the Internet. It
Git as the worlds most advanced distributed version control system (no one), presumably many people
After VPN connection is established, need to make the following settings: 1, click & ldquo; att
Kobject, kset is the basic structure of the device model. The device model uses these two structure
I don't know how to choose the advantages and disadvantages of various Linux distributions
Talking about the media player under Linux (on)
Linux sar command using basic tutorial
Ubuntu system encrypts files for transmission method
Basic configuration tutorial for IpTables under Linux
Registration of the s3c2410 device
Several ways to configure IP under Linux
Compression and decompression methods for common compression formats under Linux
The operating system's ally: Linux will dominate the rivers and lakes
Create a folder that cannot be deleted. How to operate
DNF Gods' tomb activities how to get into the DNF Gods tomb tickets invitations how to get
Win7 upgrade Win10 laptop power icon turned gray how to solve?
How about playing lol and dnf on my computer?
How to use the win8 system video application function?
Microsoft: The number of Win10 installations has reached 14 million in just two days