Linux系统Nginx安装配置

本文详细介绍了Nginx的安装过程及依赖模块解决办法,包括pcre-devel、zlib-devel、openssl和sha1等模块的安装。并演示了如何配置Nginx实现两个Tomcat实例间的简单负载均衡。

用户:root

Nginx版本:nginx-1.10.0 

  • 解压Nginx安装包

  • [root@localhost nginx]# pwd
    /home/listen/nginx
    [root@localhost nginx]# ll
    total 6040
    -rw-rw-r--.  1 listen listen  908954 May  3 00:35 nginx-1.10.0.tar.gz
    [root@localhost nginx]# tar -xvf nginx-1.10.0.tar.gz
    [root@localhost nginx]# ll
    total 6040
    drwxr-xr-x.  9 listen listen    4096 May  3 00:40 nginx-1.10.0
    -rw-rw-r--.  1 listen listen  908954 May  3 00:35 nginx-1.10.0.tar.gz

     

  • 编译前检查依赖模块

  • [root@localhost nginx-1.10.0]# pwd
    /home/listen/nginx/nginx-1.10.0
    [root@localhost nginx-1.10.0]# ll
    total 680
    drwxr-xr-x. 6 listen listen   4096 May  3 00:37 auto
    -rw-r--r--. 1 listen listen 262619 Apr 26 06:31 CHANGES
    -rw-r--r--. 1 listen listen 400302 Apr 26 06:31 CHANGES.ru
    drwxr-xr-x. 2 listen listen   4096 May  3 00:37 conf
    -rwxr-xr-x. 1 listen listen   2481 Apr 26 06:31 configure
    drwxr-xr-x. 4 listen listen     68 May  3 00:37 contrib
    drwxr-xr-x. 2 listen listen     38 May  3 00:37 html
    -rw-r--r--. 1 listen listen   1397 Apr 26 06:31 LICENSE
    -rw-rw-r--. 1 listen listen    376 May  3 01:10 Makefile
    drwxr-xr-x. 2 listen listen     20 May  3 00:37 man
    drwxrwxr-x. 3 listen listen   4096 May  3 01:12 objs
    -rw-r--r--. 1 listen listen     49 Apr 26 06:31 README
    drwxr-xr-x. 9 listen listen     84 May  3 00:37 src
    [root@localhost nginx-1.10.0]# ./configure 
    #结果:
    ./configure: error: the HTTP rewrite module requires the PCRE library.
    You can either disable the module by using --without-http_rewrite_module
    option, or install the PCRE library into the system, or build the PCRE library
    statically from the source with nginx by using --with-pcre=<path> option.
    
     结果:
  • 132023_Er2G_39617.png
  • 132038_HnL0_39617.png
  • 缺少 pcre-devel模块

  • #缺少pcre-devel模块,安装
    [root@localhost nginx-1.10.0]# yum -y install pcre-devel

    132210_bxpU_39617.png132232_ACHE_39617.png

  • 再次检查依赖模块

  • [root@localhost nginx-1.10.0]# ./configure 
    
    #结果:
    ./configure: error: the HTTP gzip module requires the zlib library.
    You can either disable the module by using --without-http_gzip_module
    option, or install the zlib library into the system, or build the zlib library
    statically from the source with nginx by using --with-zlib=<path> option.

    缺少zlib-devel模块

  • [root@localhost nginx-1.10.0]# yum install -y zlib-devel

     

  • 132526_RLwJ_39617.png 132726_cjZa_39617.png
  • 再次检查依赖模块

  • [root@localhost nginx-1.10.0]# ./configure 
    [root@localhost nginx-1.10.0]# ./configure 
    checking for OS
     + Linux 3.10.0-229.el7.x86_64 x86_64
    checking for C compiler ... found
     + using GNU C compiler
     + gcc version: 4.8.3 20140911 (Red Hat 4.8.3-9) (GCC) 
    checking for gcc -pipe switch ... found
    checking for -Wl,-E switch ... found
    checking for gcc builtin atomic operations ... found
    checking for C99 variadic macros ... found
    checking for gcc variadic macros ... found
    checking for gcc builtin 64 bit byteswap ... found
    checking for unistd.h ... found
    checking for inttypes.h ... found
    checking for limits.h ... found
    checking for sys/filio.h ... not found
    checking for sys/param.h ... found
    checking for sys/mount.h ... found
    checking for sys/statvfs.h ... found
    checking for crypt.h ... found
    checking for Linux specific features
    checking for epoll ... found
    checking for EPOLLRDHUP ... found
    checking for O_PATH ... found
    checking for sendfile() ... found
    checking for sendfile64() ... found
    checking for sys/prctl.h ... found
    checking for prctl(PR_SET_DUMPABLE) ... found
    checking for sched_setaffinity() ... found
    checking for crypt_r() ... found
    checking for sys/vfs.h ... found
    checking for nobody group ... found
    checking for poll() ... found
    checking for /dev/poll ... not found
    checking for kqueue ... not found
    checking for crypt() ... not found
    checking for crypt() in libcrypt ... found
    checking for F_READAHEAD ... not found
    checking for posix_fadvise() ... found
    checking for O_DIRECT ... found
    checking for F_NOCACHE ... not found
    checking for directio() ... not found
    checking for statfs() ... found
    checking for statvfs() ... found
    checking for dlopen() ... not found
    checking for dlopen() in libdl ... found
    checking for sched_yield() ... found
    checking for SO_SETFIB ... not found
    checking for SO_REUSEPORT ... found
    checking for SO_ACCEPTFILTER ... not found
    checking for IP_RECVDSTADDR ... not found
    checking for IP_PKTINFO ... found
    checking for IPV6_RECVPKTINFO ... found
    checking for TCP_DEFER_ACCEPT ... found
    checking for TCP_KEEPIDLE ... found
    checking for TCP_FASTOPEN ... not found
    checking for TCP_INFO ... found
    checking for accept4() ... found
    checking for eventfd() ... found
    checking for int size ... 4 bytes
    checking for long size ... 8 bytes
    checking for long long size ... 8 bytes
    checking for void * size ... 8 bytes
    checking for uint32_t ... found
    checking for uint64_t ... found
    checking for sig_atomic_t ... found
    checking for sig_atomic_t size ... 4 bytes
    checking for socklen_t ... found
    checking for in_addr_t ... found
    checking for in_port_t ... found
    checking for rlim_t ... found
    checking for uintptr_t ... uintptr_t found
    checking for system byte ordering ... little endian
    checking for size_t size ... 8 bytes
    checking for off_t size ... 8 bytes
    checking for time_t size ... 8 bytes
    checking for setproctitle() ... not found
    checking for pread() ... found
    checking for pwrite() ... found
    checking for pwritev() ... found
    checking for sys_nerr ... found
    checking for localtime_r() ... found
    checking for posix_memalign() ... found
    checking for memalign() ... found
    checking for mmap(MAP_ANON|MAP_SHARED) ... found
    checking for mmap("/dev/zero", MAP_SHARED) ... found
    checking for System V shared memory ... found
    checking for POSIX semaphores ... not found
    checking for POSIX semaphores in libpthread ... found
    checking for struct msghdr.msg_control ... found
    checking for ioctl(FIONBIO) ... found
    checking for struct tm.tm_gmtoff ... found
    checking for struct dirent.d_namlen ... not found
    checking for struct dirent.d_type ... found
    checking for sysconf(_SC_NPROCESSORS_ONLN) ... found
    checking for openat(), fstatat() ... found
    checking for getaddrinfo() ... found
    checking for PCRE library ... found
    checking for PCRE JIT support ... found
    checking for md5 in system md library ... not found
    checking for md5 in system md5 library ... not found
    checking for md5 in system OpenSSL crypto library ... not found
    checking for sha1 in system md library ... not found
    checking for sha1 in system OpenSSL crypto library ... not found
    checking for zlib library ... found
    creating objs/Makefile
    
    Configuration summary
      + using system PCRE library
      + OpenSSL library is not used
      + using builtin md5 code
      + sha1 library is not found
      + using system zlib library
    
      nginx path prefix: "/usr/local/nginx"
      nginx binary file: "/usr/local/nginx/sbin/nginx"
      nginx modules path: "/usr/local/nginx/modules"
      nginx configuration prefix: "/usr/local/nginx/conf"
      nginx configuration file: "/usr/local/nginx/conf/nginx.conf"
      nginx pid file: "/usr/local/nginx/logs/nginx.pid"
      nginx error log file: "/usr/local/nginx/logs/error.log"
      nginx http access log file: "/usr/local/nginx/logs/access.log"
      nginx http client request body temporary files: "client_body_temp"
      nginx http proxy temporary files: "proxy_temp"
      nginx http fastcgi temporary files: "fastcgi_temp"
      nginx http uwsgi temporary files: "uwsgi_temp"
      nginx http scgi temporary files: "scgi_temp"
    
    [root@localhost nginx-1.10.0]# 

     缺少openssl 和sha1模块

  • 下载openssl-1.0.2g.tar.gz安装包,并解压
  • 安装openssl,如果提示权限问题,切换root用户操作即可
  • [listen@localhost Downloads]$ tar -xvf openssl-1.0.2j.tar.gz 
    [listen@localhost Downloads]$ cd openssl-1.0.2j/
    [listen@localhost openssl-1.0.2j]$ ./config 
    [listen@localhost openssl-1.0.2j]$ make & make install
    making install in engines...
    make[1]: Entering directory `/home/listen/Downloads/openssl-1.0.2j/engines'
    making install in engines/ccgost...
    make[2]: Entering directory `/home/listen/Downloads/openssl-1.0.2j/engines/ccgost'
    [ -n "/usr/local/ssl" ] # should be set by top Makefile...
    if [ -n "" ]; then \
    	set -e; \
    	echo installing gost; \
    	pfx=lib; \
    	if expr "linux-x86_64" : "Cygwin" >/dev/null; then \
    		sfx=".so"; \
    		cp cyggost.dll /usr/local/ssl/lib/engines/${pfx}gost$sfx.new; \
    	else \
    		case "-I../../include -DOPENSSL_THREADS -D_REENTRANT -DDSO_DLFCN -DHAVE_DLFCN_H -Wa,--noexecstack -m64 -DL_ENDIAN -O3 -Wall -DOPENSSL_IA32_SSE2 -DOPENSSL_BN_ASM_MONT -DOPENSSL_BN_ASM_MONT5 -DOPENSSL_BN_ASM_GF2m -DRC4_ASM -DSHA1_ASM -DSHA256_ASM -DSHA512_ASM -DMD5_ASM -DAES_ASM -DVPAES_ASM -DBSAES_ASM -DWHIRLPOOL_ASM -DGHASH_ASM -DECP_NISTZ256_ASM" in \
    		*DSO_BEOS*) sfx=".so";; \
    		*DSO_DLFCN*) sfx=`expr ".so.1.0.0" : '.*\(\.[a-z][a-z]*\)' \| ".so"`;; \
    		*DSO_DL*) sfx=".sl";; \
    		*DSO_WIN32*) sfx="eay32.dll"; pfx=;; \
    		*) sfx=".bad";; \
    		esac; \
    		cp ${pfx}gost$sfx /usr/local/ssl/lib/engines/${pfx}gost$sfx.new; \
    	fi; \
    	chmod 555 /usr/local/ssl/lib/engines/${pfx}gost$sfx.new; \
    	mv -f /usr/local/ssl/lib/engines/${pfx}gost$sfx.new /usr/local/ssl/lib/engines/${pfx}gost$sfx; \
    fi
    make[2]: Leaving directory `/home/listen/Downloads/openssl-1.0.2j/engines/ccgost'
    make[1]: Leaving directory `/home/listen/Downloads/openssl-1.0.2j/engines'
    making install in apps...
    make[1]: Entering directory `/home/listen/Downloads/openssl-1.0.2j/apps'
    installing openssl
    installing CA.sh
    installing CA.pl
    installing tsget
    make[1]: Leaving directory `/home/listen/Downloads/openssl-1.0.2j/apps'
    making install in test...
    make[1]: Entering directory `/home/listen/Downloads/openssl-1.0.2j/test'
    make[1]: Nothing to be done for `install'.
    make[1]: Leaving directory `/home/listen/Downloads/openssl-1.0.2j/test'
    making install in tools...
    make[1]: Entering directory `/home/listen/Downloads/openssl-1.0.2j/tools'
    make[1]: Leaving directory `/home/listen/Downloads/openssl-1.0.2j/tools'
    installing libcrypto.a
    installing libssl.a
    cp libcrypto.pc /usr/local/ssl/lib/pkgconfig
    chmod 644 /usr/local/ssl/lib/pkgconfig/libcrypto.pc
    cp libssl.pc /usr/local/ssl/lib/pkgconfig
    chmod 644 /usr/local/ssl/lib/pkgconfig/libssl.pc
    cp openssl.pc /usr/local/ssl/lib/pkgconfig
    chmod 644 /usr/local/ssl/lib/pkgconfig/openssl.pc
    [1]+  Done                    make
    ####测试安装是否成功
    [root@localhost openssl-1.0.2j]# openssl
    OpenSSL> 
    

     

  • 安装sha1模块和openssl模块,安装
  • [root@localhost nginx]# pwd
    /home/listen/nginx
    [root@localhost nginx]# ll
    total 6040
    drwxr-xr-x.  9 listen listen    4096 May  3 00:40 nginx-1.10.0
    -rw-rw-r--.  1 listen listen  908954 May  3 00:35 nginx-1.10.0.tar.gz
    drwxr-xr-x. 21 root   root      4096 May  3 01:12 openssl-1.0.2g
    -rw-rw-r--.  1 listen listen 5266102 May  3 00:51 openssl-1.0.2g.tar.gz
    [root@localhost nginx]# cd nginx-1.10.0/
    
    [root@localhost nginx-1.10.2]# yum -y install perl-Digest-SHA1.x86_64 
    Loaded plugins: fastestmirror, langpacks
    Loading mirror speeds from cached hostfile
     * base: mirrors.163.com
     * extras: ftp.sjtu.edu.cn
     * updates: mirrors.163.com
    Resolving Dependencies
    --> Running transaction check
    ---> Package perl-Digest-SHA1.x86_64 0:2.13-9.el7 will be installed
    --> Finished Dependency Resolution
    
    Dependencies Resolved
    
    ==============================================================================================================================================================================
     Package                                         Arch                                  Version                                      Repository                           Size
    ==============================================================================================================================================================================
    Installing:
     perl-Digest-SHA1                                x86_64                                2.13-9.el7                                   base                                 50 k
    
    Transaction Summary
    ==============================================================================================================================================================================
    Install  1 Package
    
    Total download size: 50 k
    Installed size: 105 k
    Downloading packages:
    perl-Digest-SHA1-2.13-9.el7.x86_64.rpm                                                                                                                 |  50 kB  00:00:00     
    Running transaction check
    Running transaction test
    Transaction test succeeded
    Running transaction
      Installing : perl-Digest-SHA1-2.13-9.el7.x86_64                                                                                                                         1/1 
      Verifying  : perl-Digest-SHA1-2.13-9.el7.x86_64                                                                                                                         1/1 
    
    Installed:
      perl-Digest-SHA1.x86_64 0:2.13-9.el7                                                                                                                                        
    
    Complete!
    [root@localhost nginx-1.10.2]# 
    

     

  •  再次检查模块依赖(增加依赖参数)

  • [root@localhost nginx-1.10.0]# ./configure --with-openssl=/home/listen/nginx/openssl-1.0.2g --with-http_ssl_module
    checking for OS
     + Linux 3.10.0-229.el7.x86_64 x86_64
    checking for C compiler ... found
     + using GNU C compiler
     + gcc version: 4.8.3 20140911 (Red Hat 4.8.3-9) (GCC) 
    checking for gcc -pipe switch ... found
    checking for -Wl,-E switch ... found
    checking for gcc builtin atomic operations ... found
    checking for C99 variadic macros ... found
    checking for gcc variadic macros ... found
    checking for gcc builtin 64 bit byteswap ... found
    checking for unistd.h ... found
    checking for inttypes.h ... found
    checking for limits.h ... found
    checking for sys/filio.h ... not found
    checking for sys/param.h ... found
    checking for sys/mount.h ... found
    checking for sys/statvfs.h ... found
    checking for crypt.h ... found
    checking for Linux specific features
    checking for epoll ... found
    checking for EPOLLRDHUP ... found
    checking for O_PATH ... found
    checking for sendfile() ... found
    checking for sendfile64() ... found
    checking for sys/prctl.h ... found
    checking for prctl(PR_SET_DUMPABLE) ... found
    checking for sched_setaffinity() ... found
    checking for crypt_r() ... found
    checking for sys/vfs.h ... found
    checking for nobody group ... found
    checking for poll() ... found
    checking for /dev/poll ... not found
    checking for kqueue ... not found
    checking for crypt() ... not found
    checking for crypt() in libcrypt ... found
    checking for F_READAHEAD ... not found
    checking for posix_fadvise() ... found
    checking for O_DIRECT ... found
    checking for F_NOCACHE ... not found
    checking for directio() ... not found
    checking for statfs() ... found
    checking for statvfs() ... found
    checking for dlopen() ... not found
    checking for dlopen() in libdl ... found
    checking for sched_yield() ... found
    checking for SO_SETFIB ... not found
    checking for SO_REUSEPORT ... found
    checking for SO_ACCEPTFILTER ... not found
    checking for IP_RECVDSTADDR ... not found
    checking for IP_PKTINFO ... found
    checking for IPV6_RECVPKTINFO ... found
    checking for TCP_DEFER_ACCEPT ... found
    checking for TCP_KEEPIDLE ... found
    checking for TCP_FASTOPEN ... not found
    checking for TCP_INFO ... found
    checking for accept4() ... found
    checking for eventfd() ... found
    checking for int size ... 4 bytes
    checking for long size ... 8 bytes
    checking for long long size ... 8 bytes
    checking for void * size ... 8 bytes
    checking for uint32_t ... found
    checking for uint64_t ... found
    checking for sig_atomic_t ... found
    checking for sig_atomic_t size ... 4 bytes
    checking for socklen_t ... found
    checking for in_addr_t ... found
    checking for in_port_t ... found
    checking for rlim_t ... found
    checking for uintptr_t ... uintptr_t found
    checking for system byte ordering ... little endian
    checking for size_t size ... 8 bytes
    checking for off_t size ... 8 bytes
    checking for time_t size ... 8 bytes
    checking for setproctitle() ... not found
    checking for pread() ... found
    checking for pwrite() ... found
    checking for pwritev() ... found
    checking for sys_nerr ... found
    checking for localtime_r() ... found
    checking for posix_memalign() ... found
    checking for memalign() ... found
    checking for mmap(MAP_ANON|MAP_SHARED) ... found
    checking for mmap("/dev/zero", MAP_SHARED) ... found
    checking for System V shared memory ... found
    checking for POSIX semaphores ... not found
    checking for POSIX semaphores in libpthread ... found
    checking for struct msghdr.msg_control ... found
    checking for ioctl(FIONBIO) ... found
    checking for struct tm.tm_gmtoff ... found
    checking for struct dirent.d_namlen ... not found
    checking for struct dirent.d_type ... found
    checking for sysconf(_SC_NPROCESSORS_ONLN) ... found
    checking for openat(), fstatat() ... found
    checking for getaddrinfo() ... found
    checking for PCRE library ... found
    checking for PCRE JIT support ... found
    checking for zlib library ... found
    creating objs/Makefile
    
    Configuration summary
      + using system PCRE library
      + using OpenSSL library: /home/listen/nginx/openssl-1.0.2g
      + md5: using OpenSSL library
      + sha1: using OpenSSL library
      + using system zlib library
    
      nginx path prefix: "/usr/local/nginx"
      nginx binary file: "/usr/local/nginx/sbin/nginx"
      nginx modules path: "/usr/local/nginx/modules"
      nginx configuration prefix: "/usr/local/nginx/conf"
      nginx configuration file: "/usr/local/nginx/conf/nginx.conf"
      nginx pid file: "/usr/local/nginx/logs/nginx.pid"
      nginx error log file: "/usr/local/nginx/logs/error.log"
      nginx http access log file: "/usr/local/nginx/logs/access.log"
      nginx http client request body temporary files: "client_body_temp"
      nginx http proxy temporary files: "proxy_temp"
      nginx http fastcgi temporary files: "fastcgi_temp"
      nginx http uwsgi temporary files: "uwsgi_temp"
      nginx http scgi temporary files: "scgi_temp"
    

     

  • 编译&&安装

    [root@localhost nginx-1.10.0]# make && make install
  •  结果:
  • 133623_bZHI_39617.png
  • 133636_C3n3_39617.png
  • 测试简单的负载均衡(2个tomcat)

  • 修改Nginx配置文件nginx.conf
  •  
    
    #user  nobody;
    worker_processes  1;
    
    #error_log  logs/error.log;
    #error_log  logs/error.log  notice;
    #error_log  logs/error.log  info;
    
    #pid        logs/nginx.pid;
    
    
    events {
        worker_connections  1024;
    }
    
    
    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"';
    
        #access_log  logs/access.log  main;
    
        sendfile        on;
        #tcp_nopush     on;
    
        #keepalive_timeout  0;
        keepalive_timeout  65;
    
        #gzip  on;
        #这个地方要写ip,不要写localhost  server localhost:8080;
        upstream local_tomcat {
    		server 127.0.0.1:8080;
    		server 127.0.0.1:8088;	
        }
        server {
            listen       80;
            #这个地方要写ip,不要写localhost  server_name  localhost;
            server_name  127.0.0.1;
    
            #charset koi8-r;
    
            #access_log  logs/host.access.log  main;
    
    	location / {
    	    proxy_pass http://local_tomcat;
    	}
    
            #error_page  404              /404.html;
    
            # redirect server error pages to the static page /50x.html
            #
            error_page   500 502 503 504  /50x.html;
            location = /50x.html {
                root   html;
            }
    
            # proxy the PHP scripts to Apache listening on 127.0.0.1:80
            #
            #location ~ \.php$ {
            #    proxy_pass   http://127.0.0.1;
            #}
    
            # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
            #
            #location ~ \.php$ {
            #    root           html;
            #    fastcgi_pass   127.0.0.1:9000;
            #    fastcgi_index  index.php;
            #    fastcgi_param  SCRIPT_FILENAME  /scripts$fastcgi_script_name;
            #    include        fastcgi_params;
            #}
    
            # deny access to .htaccess files, if Apache's document root
            # concurs with nginx's one
            #
            #location ~ /\.ht {
            #    deny  all;
            #}
        }
    
    
        # another virtual host using mix of IP-, name-, and port-based configuration
        #
        #server {
        #    listen       8000;
        #    listen       somename:8080;
        #    server_name  somename  alias  another.alias;
    
        #    location / {
        #        root   html;
        #        index  index.html index.htm;
        #    }
        #}
    
    
        # HTTPS server
        #
        #server {
        #    listen       443 ssl;
        #    server_name  localhost;
    
        #    ssl_certificate      cert.pem;
        #    ssl_certificate_key  cert.key;
    
        #    ssl_session_cache    shared:SSL:1m;
        #    ssl_session_timeout  5m;
    
        #    ssl_ciphers  HIGH:!aNULL:!MD5;
        #    ssl_prefer_server_ciphers  on;
    
        #    location / {
        #        root   html;
        #        index  index.html index.htm;
        #    }
        #}
    
    }
    

    启动测试

  • 启动nginx
  • [root@localhost sbin]# whereis nginx
    nginx: /usr/local/nginx
    [root@localhost sbin]# /usr/local/nginx/sbin/nginx -c /home/listen/Downloads/nginx-1.10.2/conf/nginx.conf 
    [root@localhost sbin]# ps aux|grep nginx
    root       5548  0.0  0.0  23264   852 ?        Ss   22:05   0:00 nginx: master process /usr/local/nginx/sbin/nginx -c /home/listen/Downloads/nginx-1.10.2/conf/nginx.conf
    nobody     5549  0.0  0.1  25800  1620 ?        S    22:05   0:00 nginx: worker process
    root       5551  0.0  0.0 112648   964 pts/0    R+   22:05   0:00 grep --color=auto nginx
    [root@localhost sbin]# 
    

    启动两个tomcat,端口分别为8080,8088

  • [root@localhost bin]# ps aux|grep tomcat
    listen     4971  1.5  6.5 339772 65160 pts/2    Sl   21:39   0:02 /usr/lib/java/jre/bin/java -Djava.util.logging.config.file=/home/listen/Downloads/apache-tomcat-7.0.52-02/conf/logging.properties -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager -Djava.endorsed.dirs=/home/listen/Downloads/apache-tomcat-7.0.52-02/endorsed -classpath /home/listen/Downloads/apache-tomcat-7.0.52-02/bin/bootstrap.jar:/home/listen/Downloads/apache-tomcat-7.0.52-02/bin/tomcat-juli.jar -Dcatalina.base=/home/listen/Downloads/apache-tomcat-7.0.52-02 -Dcatalina.home=/home/listen/Downloads/apache-tomcat-7.0.52-02 -Djava.io.tmpdir=/home/listen/Downloads/apache-tomcat-7.0.52-02/temp org.apache.catalina.startup.Bootstrap start
    root       5127 46.0  5.2 333392 52796 pts/1    Sl   21:41   0:01 /usr/lib/java/jre/bin/java -Djava.util.logging.config.file=/home/listen/Downloads/apache-tomcat-7.0.52/conf/logging.properties -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager -Djava.endorsed.dirs=/home/listen/Downloads/apache-tomcat-7.0.52/endorsed -classpath /home/listen/Downloads/apache-tomcat-7.0.52/bin/bootstrap.jar:/home/listen/Downloads/apache-tomcat-7.0.52/bin/tomcat-juli.jar -Dcatalina.base=/home/listen/Downloads/apache-tomca-7.0.52 -Dcatalina.home=/home/listen/Downloads/apache-tomcat-7.0.52 -Djava.io.tmpdir=/home/listen/Downloads/apache-tomcat-7.0.52/temp org.apache.catalina.startup.Bootstrap start
    root       5146  0.0  0.0 112648   964 pts/1    R+   21:41   0:00 grep --color=auto tomcat
    [root@localhost bin]# 
    

     

  • 访问http://192.168.159.129/test,就可以访问tomcat下的test工程首页,如果想看区别,可以修改tomcat的index.jsp文件不同的内容,就可以看到区别。
  • 140848_UuBA_39617.png
  • 140901_fmUy_39617.png
  • 这个区别是我在两个war包中修改了index.jsp页面的一个为8088,一个为8080的内容

over!

转载于:https://my.oschina.net/Listening/blog/674595

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值