Rumah  >  Soal Jawab  >  teks badan

Selepas nginx bermula, mulakan tomcat. tomcat akan melaporkan ralat

Selepas saya mulakan nginx dahulu, dan kemudian mulakan tomcat, IDEA akan menggesa seperti yang ditunjukkan dalam rajah di bawah, dan kemudian saya tidak boleh mengakses halaman jsp.

Kemudian jika saya mulakan tomcat dahulu, nginx akan gagal untuk memulakan nginx Selepas memulakan nginx, tiada nginx dalam senarai proses

Ini nginx.conf saya


#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"';

    log_format  main  ' $remote_user [$time_local]  $http_x_Forwarded_for $remote_addr  $request '  
                      '$http_x_forwarded_for '  
                      '$upstream_addr '  
                      'ups_resp_time: $upstream_response_time '  
                      'request_time: $request_time';  

    access_log  logs/access.log  main;

    sendfile        on;
    #tcp_nopush     on;

    #keepalive_timeout  0;
    keepalive_timeout  65;

    #gzip  on;

    server {
        listen       8081;
        server_name  localhost:8080;

        #charset koi8-r;

        access_log  logs/host.access.log  main;

        location / {
            proxy_pass http://localhost:8080/;
        }

        #location / {
         #   root   html;
         #   index  index.html index.htm;
        #}

        #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;
    #    }
    #}

}

Masalah itu telah diselesaikan sebentar tadi. Sekarang saya menghadapi masalah lain

Apabila mengakses nginx8081 untuk meneruskan ke tomcat, kelajuannya sangat perlahan
F12 melihat


. . Halaman Muatkan tidak bermula sehingga 40 saat Yang sebelumnya gagal

淡淡烟草味淡淡烟草味2714 hari yang lalu558

membalas semua(2)saya akan balas

  • 曾经蜡笔没有小新

    曾经蜡笔没有小新2017-05-16 17:14:36

    Jika masalah berlaku, anda harus menganalisis ralat yang dilaporkan terlebih dahulu dan bukannya bertanya secara langsung. Anda mesti membangunkan kebolehan analisis dan penyelesaian masalah. Ralat seperti ini sudah jelas: diterjemahkan ia adalah persaingan pelabuhan, iaitu, program yang berbeza menggunakan port yang sama.

    balas
    0
  • 我想大声告诉你

    我想大声告诉你2017-05-16 17:14:36

    Secara amnya, port tidak boleh digunakan oleh berbilang proses Tomcat menggunakan port 8080, tetapi nginx tidak boleh. Dengan cara yang sama, jika nginx dimulakan dahulu, port 8080 telah pun diduduki, dan Tomcat tidak boleh menggunakan port ini.

    Penyelesaian ialah menukar nginx untuk mendengar port 80:

    server {
            listen       80;
            server_name  localhost;
            ......

    Anda juga boleh menukar port Tomcat, tetapi ia tidak perlu. Jika nginx digunakan sebagai hujung hadapan, 80 harus digunakan, dan Tomcat adalah pilihan.

    balas
    0
  • Batalbalas