In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-29 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/02 Report--
Recently, a new project, jlj-cms-erp-web, has been deployed, which requires the use of nginx+Tomcat to separate static pages from dynamic requests, thus reducing the pressure on the Tomcat server.
There is no nginx on the machine where the project is deployed (192.168.1.110), so you also need to back up the static pages generated on this machine to another machine with nginx (192.168.1.191).
First of all, install tomcat, the specific process will not be written in detail, see blog
Http://itzhongxin.blog.51cto.com/12734415/1915155
Pay attention to modify port number, jvmRoute, Context path, boot memory
Create a new www folder in the webapps folder under the project, and the files in this folder will be backed up
We use the rsync command to implement the backup between the two machines. We first configure the backed up side, that is, the machine that does not have nginx installed.
Install dependency packages
Apt-get updateapt-get install gccapt-get install maketar-zxvf rsync-3.1.2.tar.gz cd rsync-3.1.2./configure-prefix=/usr/local/rsync & & make & & make install
After installation, two bin share directories should be generated under the / usr/local/rsync directory.
Then create log, pid, conf and password under the current directory to store logs, program process numbers, configuration files and passwords, respectively.
Setting up Profil
Vim rsyncd.confuse chroot = nomax connections = 10pid file = / usr/local/rsync/pid/rsyncd.pidlog file = / usr/local/rsync/log/rsyncd.log [www] # whatever you want, but the same as the backup side! Uid = rootgid = rootpath = / opt/tomcat8.0.24/jlj-cms-erp-web/webapps/www # the path to be backed up comment = wwwbackupread only = no#write only = nolist = yeshosts allow = 192.168.1.191and24 # backup to this machine hosts dengy = * auth users = backupsecrets file = / usr/local/rsync/password/server.pass # password file path
Set password file
Vim server.pass backup:BACKup_194
Modify password file permissions
Chmod 600 server.pass
Start the rsync service
/ usr/local/rsync/bin/rsync-daemon-config=/usr/local/rsync/conf/rsyncd.conf
Whether the filter started successfully
Ps-ef | grep rsyncroot 22620 10 15:17? 00:00:00. / bin/rsync-- daemon-- config=/usr/local/rsyn/conf/rsyncd.conf
Then extract a site.zip package under / opt/tomcat8.0.24/jlj-cms-erp-web/webapps/www, which contains a large number of static HTML files, which we need to synchronize to 192.168.1.191
Next, configure the backup side, as above
After installation, two bin share directories should be generated under the / usr/local/rsync directory.
Create a pwd directory to store password files
Vim server.pass BACKup_194
Modify password file permissions
Chmod 600 server.pass
Create a new jljapp folder under / var/www and back up things to that path
Test whether the backup can be successful.
Rsync-vzrtopg-progress-password-file=/usr/local/rsync/pwd/server.pass backup@192.168.1.110::www / var/www/jljapp
* the red mark here must be the same as the module name in the rsync.conf on the backup side.
Check to see if there is a successful backup to what we need in the backup path.
Cd / var/www/jljappll
If the backup is successful, write a script
Cd / usr/local/rsync/binvim rsync backgrounds 110% www.shackle password-file=/usr/local/rsync/pwd/server.pass backup@192.168.1.110::www / var/www/jljapp
Modify script permissions
Chmod axix rsyncback_110_www.sh
Make a task plan and set the synchronization task to be carried out every Friday at 8: 00 p.m.
# back up the html*/5 generated by 110cms * / bin/sh / usr/local/rsync/bin/rsyncback_110_www.sh every five minutes
The backup is complete, and then nginx forwards the request to tomcat
Deploy project jlj-cms-erp-web on the backed up side, that is, 192.168.1.110
Unpack the project package under / opt/tomcat8.0.24/jlj-cms-erp-web/webapps and delete the compressed package
Start the project and view the log
Cd bin/./startup.sh tail-f.. / logs/catalina.out
Bind the domain name on the nginx machine, and nginx receives the access request from the client and forwards it to the corresponding tomcat server according to the address
Now the demand is that there are three domain names and three configuration files.
Cms.erp.jinlejia.com
Cmsstyle.erp.jinlejia.com
Mhelp.erp.jinlejia.com
Need to modify the configuration file of nginx, create a new jljapp folder, and put three configuration files
Cd / etc/nginx/conf.dmkdir jljapp
Copy a previously configured file for the project to modify
Cp group_js.conf jljapp/mhelp.confvim mhelp.confserver {listen 80; server_name mhelp.erp.jinlejia.com; root / var/www/jljapp/site/help; index index.html index.htm; location / {} error_page 404 500 502 503 504 / 404.html; location = / 404.html {root / usr/share/nginx/html }} cp mhelp.conf cmsstyle.confvim cmsstyle.confserver {listen 80; server_name cmsstyle.erp.jinlejia.com; root / var/www/jljapp; index index.html index.htm; location / {} error_page 404 500 502 503 504 / 404.html; location = / 404.html {root / usr/share/nginx/html }} cp sso.conf jljapp/cms.confcd jljapp/vim cms.conf upstream jljappcms {server 192.168.1.110 weight=20 max_fails=2 fail_timeout=30s; ip_hash;} server {listen 80; server_name cms.erp.jinlejia.com; root / Disk/var/www/index; index index.html index.htm; proxy_max_temp_file_size 0; large_client_header_buffers 4 16k Client_max_body_size 300m; client_body_buffer_size 128k; proxy_connect_timeout 600; proxy_read_timeout 600; proxy_send_timeout 600; proxy_buffering on; proxy_buffer_size 64k; proxy_buffers 32 64k; proxy_busy_buffers_size 128k; location / {proxy_pass http://jljappcms; proxy_set_header HOST $host Proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-FOR $proxy_add_x_forwarded_for;} # error_page 500 502 503 504 / 50x.html; # location = / 50x.html {# root / usr/share/nginx/html;}}
Finally, modify the main configuration file and add it on the last line. When nginx loads the configuration file, it automatically loads the subconfiguration file in include.
Vim nginx.confinclude / etc/nginx/conf.d/jljapp/*.conf
Restart nginx
Service nginx restart
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.