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 > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly introduces "the method of building and configuring nginx server". In the daily operation, I believe that many people have doubts about the method of building and configuring nginx server. The editor consulted all kinds of materials and sorted out simple and easy-to-use operation methods. I hope it will be helpful to answer the doubts about "how to build and configure nginx server". Next, please follow the editor to study!
Install compilation tools and library files
Depending on the library installation, be sure to install it sequentially:
(1) if the C++ compilation environment is not installed
Yum install gcc-c++
(2) openssl library is required for ssl function
Wget https://www.openssl.org/source/openssl-1.1.0f.tar.gztar-zxvf openssl-1.1.0f.tar.gzcd openssl-1.1.0f./config make & & make install
(3) pcre library is required for rewrite module
Wget https://ftp.pcre.org/pub/pcre/pcre-8.01.tar.gztar-zxvf pcre-8.01.tar.gzcd pcre-8.01./configure make & & make install
(4) zlib library is required for gzip module
Wget https://nchc.dl.sourceforge.net/project/libpng/zlib/1.2.11/zlib-1.2.11.tar.gztar-zxvf zlib-1.2.11.tar.gzcd zlib-1.2.11./configure make & & make install
(4) nginx installation
Wget http://nginx.org/download/nginx-1.12.1.tar.gztar-zxvf nginx-1.12.1.tar.gzcd nginx-1.12.1./configure-- prefix=/usr/local/nginx make & & make install
Second, set up dependent library connections
If there is an error in the input statement:. / usr/local/nginx/sbin/nginx:
Error while loading shared libraries: libpcre.so.0: cannot open shared object file: No such file or directory
You can enter:
Whereis libpcre.so.1
Results: libpcre.so: / lib64/libpcre.so.1 / usr/local/lib/libpcre.so / usr/local/lib/libpcre.so.0
Then use the ln command to connect libpcre.so.0,libpcre.so and libpcre.so.1 to the lib64 directory:
Ln-s / usr/local/lib/libpcre.so.0 / lib64
III. Nginx configuration
Create the user www used by the Nginx run:
/ usr/sbin/groupadd www/usr/sbin/useradd-g www www
To configure ngix.conf, enter: vi / usr/local/webserver/nginx/conf/nginx.conf to modify the content as follows:
User www www;worker_processes 2 errorists log.. / error.log;pid / usr/local/nginx/nginx.pid;worker_rlimit_nofile 65535 events {use epoll; worker_connections 65535;} http {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"; server_names_hash_bucket_size 128; client_header_buffer_size 32k; large_client_header_buffers 4 32k; client_max_body_size 8m; sendfile on; tcp_nopush on; keepalive_timeout 60; tcp_nodelay on Fastcgi_connect_timeout 300; fastcgi_send_timeout 300; fastcgi_read_timeout 300; fastcgi_buffer_size 64k; fastcgi_buffers 4 64k; fastcgi_busy_buffers_size 128k; fastcgi_temp_file_write_size 128k; gzip on; gzip_min_length 1k; gzip_buffers 4 16k; gzip_http_version 1.0; gzip_comp_level 2; gzip_types text/plain application/x-javascript text/css application/xml; gzip_vary on; server {listen 80Tracer / port server_name localhost / / Domain name index test.html index.htm index.php;// resolution web page name root / usr/local/nginx/html; # site directory location ~. *\. (php | php5)? ${# fastcgi_pass unix:/tmp/php-cgi.sock; fastcgi_pass 127.0.0.1 location 9000; fastcgi_index index.php; include fastcgi.conf;} location ~. *\. (gif | jpg | jpeg | bmp | swf | ico) ${expires 30d; # access_log off } location ~. *\. (js | css)? ${expires 15d; # access_log off;} access_log off;}}
Check that the configuration is correct:
/ usr/local/webserver/nginx/sbin/nginx-t
Start: / usr/local/webserver/nginx/sbin/nginx
Listening process: ps-ef | grep nginx
Access server IP: 192.168.1.23
Problem: when the configuration is correct, the IP address will be inaccessible:
You can configure it through Ali CVM, esc Server-> Security Group-> configure rules-> add rules.
At this point, the study on "the method of building and configuring nginx server" is over. I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!
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.