In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly explains the "installation and configuration steps of Nginx+Tomcat integration under Linux". The content of the article is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought to study and learn the installation and configuration steps of Nginx+Tomcat integration under Linux.
First, install Tomcat and JDK
1. Upload apache-tomcat-6.0.18.tar.gz and jdk-6u12-linux-i586.bin to / usr/local
2. Execute the following command to install tomcat:
# cd / usr/local # tar zxvf apache-tomcat-6.0.18.tar.gz
Rename apache-tomcat-6.0.18 to tomcat after decompression is complete
3. Execute the following command to install JDK:
#. / jdk-6u12-linux-i586.bin
4. Configure environment variables:
Edit the profile file under / etc and add the following:
JAVA_HOME= "/ usr/local/jdk1.6.0_12" CLASS_PATH= "JAVAHOME/lib:JAVA_HOME/lib:JAVAHOME/lib:JAVA_HOME/jre/lib" PATH= ".: PATH:PATH:PATH:JAVA_HOME/bin" CATALINA_HOME= "/ usr/local/tomcat" export JAVA_HOME CATALINA_HOME
5. Start tomcat and enter http://localhost:8080. If you see the cat's page, that is, tomcat and jdk are installed successfully.
6. Create a new file directory / home/www to store the website, set the server.xml file, and change the path to appBase= to / home/www/web at the Host name= "localhost".
7. Create index.jsp to / home/www/web/ROOT with the following content: "My web!"
Second, install Nginx
1. Upload nginx-0.7.63.tar.gz to / usr/local
2. Execute the following command to decompress nginx:
# cd / usr/local # tar zxvf nginx-0.7.63.tar.gz
3. Compile and install nginx
# cd nginx-0.7.63#./configure-- with-http_stub_status_module-- with-http_ssl_module # launch the server status page and https module
After execution, you will be prompted with an error saying that the missing PCRE library is the HTTP Rewrite module, that is, the url static package.
You can upload pcre-7.9.tar.gz and enter the following command to install it:
# tar zxvf pcre-7.9.tar.gz # cd pcre-7.9#./configure # make # make install
After installing pcre successfully, continue to install nginx
# cd nginx-0.7.63#./configure # make # make install
4. After successful installation of nginx, the installation directory is / usr/local/nginx.
Create a new proxy.conf in the conf folder to configure some proxy parameters, as follows:
#! nginx (-) # proxy.conf proxy_redirect off; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; # get the real ip # proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; # get the agent's real ip client_max_body_size 10m; client_body_buffer_size 128k; proxy_connect_timeout 90; proxy_send_timeout 90; proxy_read_timeout 90; proxy_buffer_size 4k; proxy_buffers 4 32k Proxy_busy_buffers_size 64k; proxy_temp_file_write_size 64k
Edit the nginx.conf in the conf folder under the installation directory and enter the following
# user name and user group where nginx is running # user www www; # number of startup processes worker_processes 8; # Global error log and PID file
Error_log / usr/local/nginx/logs/nginx_error.log crit; pid / usr/local/nginx/nginx.pid; # Specifies the value for maximum file descriptors that can be opened by this process. Worker_rlimit_nofile 65535; # working mode and upper limit of connections events {use epoll; worker_connections 65535;} # set http server, use its reverse proxy function to provide load balancing support http {# set mime type include mime.types; default_type application/octet-stream; include / usr/local/nginx/conf/proxy.conf; # charset gb2312; # set request buffer 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; # limit_zone crawler KaTeX parse error: Expected 'EOF', got' #'at position 25: … Mote_addr 10m; # disable # # prohibit access to the site se through ip. # all jsp pages are handed over to tomcat for processing {index index.jsp; proxy_pass http://localhost:8080; # turning to tomcat processing} location ~. (gif | jpg | jpeg | png | bmp | swf) $# set access to static files to read directly without going through tomcat {expires 30d;} location ~. (js | css)? ${expires 1h } # define the writing format of the access log log_format access'$remote_addr-remoteuser [remote _ user [remoteusername [time _ local] "KaTeX parse error: Double superscript at position 12: request" 'Mr. status bodybytessent "body_bytes_sent" bodybytessent "http_referer"''"$http_user_agent" $http_x_forwarded_for'; access_log / usr/local/nginx/logs/localhost.log access;# set the storage path of the access log}
Http://www.iis7.com/a/lm/vpsdq/}
Thank you for reading, the above is the "installation and configuration steps of Nginx+Tomcat integration under Linux". After the study of this article, I believe you have a deeper understanding of the installation and configuration steps of Nginx+Tomcat integration under Linux, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!
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.