nginx configuration and installation tutorial
Nginx ("engine Nginx is powered by Igor Sysoev was developed for the second most visited Rambler.ru site in Russia. The first public version 0.1.0 was released on 2004year10month4day. It releases its source code under a BSD-like license and is known for its stability, rich feature set, sample configuration files, and low system resource consumption. 2011year6month1day,nginx 1.0.4released. Generally we need to install
pcre and zlibfirst, the former is for rewritingrewrite, and the latter is for
gzipcompression.
1.Select the source code directory Selected directory /usr/local/
cd /usr/local/
2.Install the PCRE
librarycd /usr/local/
wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.21.tar.gz
tar -zxvf pcre-8.21.tar.gz
cd pcre-8.21
./configure
make
make install
3.Install the zlib
librarycd /usr/local/
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
4.Install ssl
cd /usr/local/
wget http://www.openssl.org/source/openssl-1.0.1c.tar.gz
tar -zxvf openssl-1.0.1c.tar.gz
./config
make
make install
5.Install nginx
Nginx generally has two versions, namely the stable version and the development version. You can choose one of these two versions according to your purpose. The following is to install Nginx
into the/usr/local/nginx directory Detailed steps below:
cd /usr/local/
wget http://nginx.org/download/nginx-1.2.8.tar.gz
tar -zxvf nginx-1.2.8.tar.gz
cd nginx-1.2.8
./configure --prefix=/usr/local/nginx
make
make install
--with-pcre=/usr/src/pcre-8.21 refers to the source code path of pcre-8.21
.--with-zlib=/usr/src/zlib-1.2.7
refers to the source code path ofzlib-1.2.7 .
6.Start
Make sure that the system’s80 port is not occupied by other programs.
/usr/local/nginx/sbin/nginx
Check whether the startup is successful:
netstat -ano|grep 80
If the result is entered, it means the startup is successful
Open the browser to access the
IP of this machine. If the browser displays Welcome to nginx!
, it means thatNginx has been installed and run successfully.
7.Restart
/usr/local/nginx/sbin/nginx –s reload
8.Modify configuration file
cd /usr/local/nginx/conf
vi nginx.conf
9.Common nginx configuration
#nginxRun user and group
user www www;
#Start process
, is usually set to be equal to the number of
cpu worker_processes 4;
#Global error log and PIDfile
pid /var/run/nginx.pid;
error_log /var/log/nginx/error.log;
events {
O p#Epoll is a way in multiple ways to reuse Io (I/O Multiplexing) , but only for the kernel of linux2.6 or above, , , Can greatly improve the performancenginx
use epoll;#
The maximum number of concurrent connections for a single backgroundworker processprocess
worker_connections 10240;}
#
Set up the httpserver and use its reverse proxy function to provide load balancing support
http{include
T Default_Type Application/OCTET-Stream;
error_page 400 403 500 502 503 504 /50x.html;
index index.html index.shtml
autoindex off;
fastcgi_intercept_errors on;
sendfile on;
# These are good default values.
tcp_nopush on;
tcp_nodelay off;
# output compression saves bandwidth
gzip off;
#gzip_static on;
#gzip_min_length 1k;
gzip_http_version 1.0;
gzip_comp_level 2;
gzip_buffers 4 16k;
gzip_proxied any;
gzip_disable "MSIE [1-6].";
gzip_types text/plain text/html text/css application/x-javascript application/xml application/xml+rss text/javascript;
#gzip_vary on;
server_name_in_redirect off;
#
Set the load balancing server listupstream portals {
server 172.16.68.134:8082 max_fails=2 fail_timeout=30s;
server 172.16.68.135:8082 max_fails=2 fail_timeout=30s;
server 172.16.68.136:8082 max_fails=2 fail_timeout=30s;
server 172.16.68.137:8082 max_fails=2 fail_timeout=30s;
}
#upstream overflow {
~
##}
server {
Listen 8080; A Server_name 127.0.0.1;
#403, 404
page redirection addresserror_page 403 = http://www.e100.cn/ebiz/other/217/403.html;
error_page 404 = http://www.e100.cn/ebiz/other/218/404.html;
proxy_connect_timeout 90;
S proxy_send_timeout 180;Re proxy_read_timeout 180;
proxy_buffer_size 64k;
proxy_buffers 4 128k;
proxy_busy_buffers_size 128k;
large_client_header_buffers 4 64k;
#proxy_read_timeout
#proxy_buffer_size#proxy_buffers
proxy_set_header Host $http_host;
proxy_max_temp_file_size 0;
#proxy_hide_header Set-Cookie;
# if ($host != 'www.e100.cn' ) {
# rewrite ^/(.*)$ http://www.e100.cn/$1 permanent;
# }
location / {
deny all;
}
location ~ ^/resource/res/img/blue/space.gif {
proxy_pass http://tecopera;
}
location = / {
rewrite ^(.*)$ /ebiz/event/517.html last;
}
location = /ebiz/event/517.html {
add_header Vary Accept-Encoding;
root /data/web/html;
expires 10m;
}
location = /check.html {
root /usr/local/nginx/html/;
access_log off;
}
location = /50x.html {
root /usr/local/nginx/html/;
expires 1m;
access_log off;
}
Location = /index.html {
add_header Vary Accept-Encoding;
#Define the default website root location of the server
root /data/web/html/ebiz;
with 10m;
}
#Define reverse proxy access name
Location ~ ^/ecps-portal/* {
# expires 10m;
#Redirect cluster name
proxy_pass http://portals;
#proxy_pass http://172.16.68.134:8082;
}
Location ~ ^/fetionLogin/* {
# expires 10m;
proxy_pass http://portals;
#proxy_pass http://172.16.68.134:8082;
}
to
#}
Location ~ ^/rsmanager/* {
with 10m;
root /data/web/;
#proxy_pass http://rsm;
}
#Definition of page suffix processed by nginx
Location ~* (.*).(jpg|gif|htm|html|png|js|css)$ {
Since
#The page cache time is 10minutes
10 Expires 10m;}
#
Set the address to view the status of Nginx
Location ~* ^/NginxStatus/ {stub_status on;
access_log off;
allow 10.1.252.126;
allow 10.248.6.49;
allow 127.0.0.1;
}
#
# proxy_pass
#
access_log /data/logs/nginx/access.log combined;
error_log /data/logs/nginx/error.log;
}
server {
Listen 8082;
location = /check.html {
root /usr/local/nginx/html/;
access_log off;
}
}
server {
listen 8088;
server_name _;
location ~ ^/* {
root /data/web/b2bhtml/;
access_log off;
}
}
server {
listen 9082;
server_name _;
# location ~ ^/resource/* {
# expires 10m;
# root /data/web/html/;
# }
location / {
root /data/web/html/sysMaintain/;
if (!-f $request_filename) {
rewrite ^/(.*)$ /sysMaintain.html last;
}
}
}
}
以上就介绍了nginx 配置安装教程,包括了nginx 配置方面的内容,希望对PHP教程有兴趣的朋友有所帮助。

What’s still popular is the ease of use, flexibility and a strong ecosystem. 1) Ease of use and simple syntax make it the first choice for beginners. 2) Closely integrated with web development, excellent interaction with HTTP requests and database. 3) The huge ecosystem provides a wealth of tools and libraries. 4) Active community and open source nature adapts them to new needs and technology trends.

PHP and Python are both high-level programming languages that are widely used in web development, data processing and automation tasks. 1.PHP is often used to build dynamic websites and content management systems, while Python is often used to build web frameworks and data science. 2.PHP uses echo to output content, Python uses print. 3. Both support object-oriented programming, but the syntax and keywords are different. 4. PHP supports weak type conversion, while Python is more stringent. 5. PHP performance optimization includes using OPcache and asynchronous programming, while Python uses cProfile and asynchronous programming.

PHP is mainly procedural programming, but also supports object-oriented programming (OOP); Python supports a variety of paradigms, including OOP, functional and procedural programming. PHP is suitable for web development, and Python is suitable for a variety of applications such as data analysis and machine learning.

PHP originated in 1994 and was developed by RasmusLerdorf. It was originally used to track website visitors and gradually evolved into a server-side scripting language and was widely used in web development. Python was developed by Guidovan Rossum in the late 1980s and was first released in 1991. It emphasizes code readability and simplicity, and is suitable for scientific computing, data analysis and other fields.

PHP is suitable for web development and rapid prototyping, and Python is suitable for data science and machine learning. 1.PHP is used for dynamic web development, with simple syntax and suitable for rapid development. 2. Python has concise syntax, is suitable for multiple fields, and has a strong library ecosystem.

PHP remains important in the modernization process because it supports a large number of websites and applications and adapts to development needs through frameworks. 1.PHP7 improves performance and introduces new features. 2. Modern frameworks such as Laravel, Symfony and CodeIgniter simplify development and improve code quality. 3. Performance optimization and best practices further improve application efficiency.

PHPhassignificantlyimpactedwebdevelopmentandextendsbeyondit.1)ItpowersmajorplatformslikeWordPressandexcelsindatabaseinteractions.2)PHP'sadaptabilityallowsittoscaleforlargeapplicationsusingframeworkslikeLaravel.3)Beyondweb,PHPisusedincommand-linescrip

PHP type prompts to improve code quality and readability. 1) Scalar type tips: Since PHP7.0, basic data types are allowed to be specified in function parameters, such as int, float, etc. 2) Return type prompt: Ensure the consistency of the function return value type. 3) Union type prompt: Since PHP8.0, multiple types are allowed to be specified in function parameters or return values. 4) Nullable type prompt: Allows to include null values and handle functions that may return null values.


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

SecLists
SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

DVWA
Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software

SAP NetWeaver Server Adapter for Eclipse
Integrate Eclipse with SAP NetWeaver application server.

MinGW - Minimalist GNU for Windows
This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.

Safe Exam Browser
Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.