In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)05/31 Report--
This article mainly introduces the relevant knowledge of "Nginx brief installation and configuration case analysis". The editor shows you the operation process through the actual case, and the operation method is simple, fast and practical. I hope this "Nginx brief installation and configuration case analysis" article can help you solve the problem.
1. Files required for nginx installation
1), nginx-1.2.8.tar.gz
2), openssl-1.0.1g.tar.gz
3), pcre-8.31.tar.gz
4), zlib-1.2.7.tar.gz
The download address of the above installation package is normally available, as I am using the above version of the installation package, so the following installation is based on this.
2. Configuration environment of linux machine
2.1.The java environment
$java-versionjava version "1.8.0mm 45" java (tm) se runtime environment (build 1.8.0_45-b14) java hotspot (tm) 64-bit server vm (build 25.45-b02, mixed mode)
2.2, hardware configuration
3. Installation steps
3.1. Extract the installation package
Go to the nginx installation directory and extract the four tar packages openssl-1.0.1g.tar.gz, pcre-8.31.tar.gz, zlib-1.2.7.tar.gz and nginx-1.2.8.tar.gz, respectively, by executing the command tar-zxvf xxxx.tar.gz, where xxxx is the package name.
After decompression:
3.2. Compile and install the package
First compile the three required library packages: openssl-1.0.1g, pcre-8.31, and zlib-1.2.7.
Compile openssl-1.0.1g, go to the file directory, and execute the following command in turn:
$. / config$make$make install
Normal installation results:
Compile pcre-8.31, go to the file directory, and execute the following command in turn:
$. / config$make$make install
Normal installation results:
Compile zlib-1.2.7, go to the file directory, and execute the following command in turn:
$. / configure$make$make install
Normal installation results:
Next, compile the nginx installation package, enter the file directory, and execute. / configure you need to specify the installation directory-prefix=/opt/nginx/nginx and the path to the corresponding library files
Sudo. / configure-prefix=/opt/nginx/nginx-with-openssl=/opt/nginx/openssl-1.0.1g-with-pcre=/opt/nginx/pcre-8.31-with-zlib=/opt/nginx/zlib-1.2.7
Next, compile and install.
The copy code is as follows:
Sudo. / configure-prefix=/opt/nginx/nginx-with-openssl=/opt/nginx/openssl-1.0.1g-with-pcre=/opt/nginx/pcre-8.31-with-zlib=/opt/nginx/zlib-1.2.7
Next, compile and install.
$make
$make install
At this point, the nginx installation is complete.
3. Start nginx
Go to the nginx installation directory / opt/nginx/nginx/sbin and execute. / nginx to start the service.
[dddd.et15sqa / opt/nginx/nginx/sbin]
$sudo. / nginx
View the post-startup service process:
$ps aux | grep nginx
Root 2295 0.0 0.0 28264 804? Ss 23:30 0:00 nginx: master process. / nginx
Nobody 2296 0.0 0.0 28660 1356? S 23:30 0:00 nginx: worker process
125233 2411 0.0 113720 1012 pts/0 s + 23:31 0:00 grep nginx
Open the nginx default home page:
Service installation and startup of ok!
4. Port forwarding
Port 80 needs to be forwarded to the tomcat home page running on the server, which has port 8080.
Tomcat homepage:
Configure the nginx.conf file for nginx as follows:
Server {listen 80; server_name 127.0.0.1; # charset koi8-r; # access_log logs/host.access.log main; location / {# root html; # index index.html index.htm; proxy_set_header host $host; proxy_set_header x-real-ip $remote_addr; proxy_set_header x-forwarded-for $remote_addr Proxy_pass http://127.0.0.1:8080;}
Restart the nginx service,. / nginx-s reload
At this point, you can access port 80, but it is actually a service that jumps to port 8080.
This is the end of the introduction to "Nginx brief installation configuration instance Analysis". Thank you for your reading. If you want to know more about the industry, you can follow the industry information channel. The editor will update different knowledge points for you every day.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.