Integration of Nginx and Tomcat and implementation of cross-domain Functions
1 Preparation 1): Download the JDK version used during project development and the most stable Nginx and Tomcat .tar.gz compressed package, and upload it to a directory. 2. decompress the jdk package and configure the environment variables, note the environment variables. Use the javac command to check whether the variables are suitable after configuration! Vim or vi/etc/profile. Use gg to pull down the file and add the following content. Note the path. My path does not represent your path! Wq exit and save
# Source/etc? Http://www.bkjia.com/kf/ware/vc/ "target =" _ blank "class =" keylink "> memory + s7Hkwb + 1xMXk1sPOxLz + ceiling/CDW2MP8w/ceiling + ceiling/CAgsrnG68qj0 + C9xbG + w/ceiling + ceiling/ v/bOjo6jXoqO609DP7sS/messages + CiAgICC08r + q5K/AwMb3o6y8/MjrICAgINb3u/q12Na3OjgwODAgICC/paper = "http://www.2cto.com/uploadfile/Collfiles/20150327/2015032710000132.png" alt = "\">
OK. It's okay to start. Please turn it off first!
OK. It's okay to start. Please turn it off first!
#./Sh tab to complete and press ENTER
4. Install nginx. This is a little troublesome. Assume that our nginx compressed package is under usr/local.
# Cd/usr/locar
# Tar zxvf followed by the compressed package name
# Cd/usr/local/decompressed folder
# Yum-y install gcc pcre-devel openssl \
> Openssl-devel gd-devel perl-ExtUtils-Embed
This command solves all dependencies related to nginx!
# Cd sbin/
#./Configure
Check whether an error is reported. If no error is reported, wait for the check!
#./Nginx
#
Enter the host address in the browser and press Enter.
Welcome to nginx!
OK. nginx deployment is complete.
5 reverse proxy settings and engineering deployment
# Cd/usr/local/nginx/conf
# Vim nginx. conf
Locate the location section and comment out the default two rows. In addition, you can directly jump to tomcat when accessing 192.168.254.23!
Wq exit and save!
# Cd/usr/local/nginx/sbin
#./Nginx-s reload
Restart and load the configuration file. Let's access 192.168.254.23 again. You will find the kitten! At this point, we have already achieved a jump from port 80 to port 8080 on the same server! Cross-origin problems encountered in ajax architecture development can be solved in the server segment. The principle is as follows. But in the real production environment, we still need to do more work.