NginxV180 installation and configuration
1. Install related support libraries:
yum -y install gcc gcc-c++ autoconf
yum -y install openssl openssl-devel
pcre: for rewrite, zlib: for gzip compression, ngx_pagespeed plug-in: front-end web page access speed optimization plug-in
(1)pcre installation:
wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.36.tar.gz
tar -zxvf pcre-8.36.tar.gz
cd pcre-8.36
./configure
make && make install
cd ../
ln -s /usr/local/lib/libpcre.so.1 /lib64/
(2) zlib installation:
wget http://zlib.net/zlib-1.2.8.tar.gz
tar -zxvf zlib-1.2.8.tar.gz
cd zlib-1.2.8
./configure
make && make install
cd ../
(3) openssl installation:
wget http://www.openssl.org/source/openssl-1.0.1c.tar.gz
tar -zxvf openssl-1.0.1c.tar.gz
cd openssl-1.0.1c
./config
make && make install
cd ../
(4)pagespeed installation:
wget https://github.com/pagespeed/ngx_pagespeed/archive/v1.8.31.4-beta.tar.gz
wget https://dl.google.com/dl/page-speed/psol/1.8.31.4.tar.gz
tar -zxvf v1.8.31.4-beta.tar.gz
cp 1.8.31.4.tar.gz ./ngx_pagespeed-1.8.31.4-beta
cd ngx_pagespeed-1.8.31.4-beta
tar -xzvf 1.8.31.4.tar.gz
2. nginx installation
Create dedicated users and user groups:
/usr/sbin/groupadd www
/usr/sbin/useradd -g www www
ulimit -SHn 65535
wget http://nginx.org/download/nginx-1.8.0.tar.gz
tar -zxvf nginx-1.8.0.tar.gz
cd nginx-1.8.0
./configure –user=www
–prefix=/usr/local/nginx
–with-http_ssl_module
–with-http_stub_status_module
–with-http_realip_module
–add-module=/home/yq/ngx_pagespeed-1.8.31.4-beta
make && make install
3. Related configuration files:
1. nginx.conf
user www www;
worker_processes 4;
error_log /var/log/nginx/error.log;
pid /var/run/nginx.pid;
events {
use epoll;
worker_connections 1024;
}
http {
upstream tomcat7{
server 127.0.0.1:8090;
}
upstream fdfs{
server 192.168.77.32:8888;
}
pagespeed On;
pagespeed FileCachePath “/var/cache/ngx_pagespeed/”;
pagespeed EnableFilters combine_css,combine_javascript;
<code>include mime.types; default_type application/octet-stream; #log_format main '$remote_addr - $remote_user [$time_local] "$request" ' # '$status $body_bytes_sent "$http_referer" ' # '"$http_user_agent" "$http_x_forwarded_for"'; #access_log logs/access.log main; sendfile on; #tcp_nopush on; #keepalive_timeout 0; keepalive_timeout 65; gzip on; gzip_min_length 1000; gzip_buffers 4 16k; gzip_http_version 1.1; gzip_types text/plain application/x-javascript text/css application/xml; include vhost.conf; include vhost/*; </code>
}
vhost.conf is the default project, which contains a virtual machine configuration,
server {
listen 80;
server_name localhost;
<code> #charset koi8-r; #access_log logs/host.access.log main; location / { root html; index index.html index.htm; } #error_page 404 /404.html; error_page 500 502 503 504 /50x.html; location = /50x.html { root html; } } </code>
The following is a typical virtual machine configuration:
test.conf
server {
listen 80;
server_name test.qq.cn;
<code>#charset koi8-r; #access_log logs/host.access.log main; proxy_set_header REMOTE-HOST $remote_addr; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_connect_timeout 30; proxy_read_timeout 60; proxy_buffer_size 4k; proxy_buffers 4 32k; proxy_busy_buffers_size 64k; proxy_temp_file_write_size 64k; proxy_max_temp_file_size 128m; proxy_set_header Host $host; proxy_pass_header User-Agent; location / { proxy_pass http://tomcat7; } location /assets { root html; index index.html; } #error_page 404 /404.html; # redirect server error pages to the static page /50x.html # error_page 500 502 503 504 /50x.html; location = /50x.html { root html; } </code>
}
The above introduces the installation and configuration of NginxV180, including the relevant content. I hope it will be helpful to friends who are interested in PHP tutorials.

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics











Guide to Table Border in HTML. Here we discuss multiple ways for defining table-border with examples of the Table Border in HTML.

This is a guide to Nested Table in HTML. Here we discuss how to create a table within the table along with the respective examples.

Guide to HTML margin-left. Here we discuss a brief overview on HTML margin-left and its Examples along with its Code Implementation.

Guide to HTML Table Layout. Here we discuss the Values of HTML Table Layout along with the examples and outputs n detail.

Guide to HTML Input Placeholder. Here we discuss the Examples of HTML Input Placeholder along with the codes and outputs.

This tutorial demonstrates how to efficiently process XML documents using PHP. XML (eXtensible Markup Language) is a versatile text-based markup language designed for both human readability and machine parsing. It's commonly used for data storage an

Guide to the HTML Ordered List. Here we also discuss introduction of HTML Ordered list and types along with their example respectively

Guide to HTML onclick Button. Here we discuss their introduction, working, examples and onclick Event in various events respectively.
