zoukankan      html  css  js  c++  java
  • Linux Tomcat 80端口 Port 80 required by Tomcat v8.5 Server at localhost is already in use.

    Port 80 required by Tomcat v8.5 Server at localhost is already in use. The server may already be running in another process, or a system process may be using the port. To start this server you will need to stop the other process or change the port number(s).

    因为装上了ubuntu,就在eclipse上设置tomcat端口为80,但是就显示说已被占用,不过我电脑才刚装上ubuntu,正常应该是没有其他程序被占用,然后在stackoverflow上发现的一个解答就是说linux不开放1024以下的端口给非root用户。

    上网找了好多解答,我感觉还是用nginx比较靠谱,毕竟以后应该会用nginx比较多,所以我就用nginx解决了。

    利用nginx把80端口的转发到8080(我在tomcat上设置的1024以上的端口)。

    nginx在ubuntu上安装的简单方法,也可以用其他方法安装,随习惯

    sudo apt-get install nginx

    我的nginx的配置文件在/etc/nginx/nginx.conf,因为配置文件默认include了/etc/nginx/sites-available/default,这个default就是初始的nginx配置文件,里面设置了当前nginx的默认端口,也就是80,当然也可以修改为其他的。

    我就在default文件里的server里,修改了location为

            location / {
     44                 # First attempt to serve request as file, then
     45                 # as directory, then fall back to displaying a 404.
     46                 # try_files $uri $uri/ =404;
     47                 proxy_pass http://localhost:8080;
     49                 index index;
     50                 root /;
     51         }
    

    然后就保存,在命令行里输入sudo nginx -s reload

    没有显示错误就代表对了,然后我就启动tomcat,在地址栏输入了localhost,成功跳转了tomcat的项目里了。

  • 相关阅读:
    sql server中sql语句中单引号怎么转义?【转】
    如何配置Eclipse+Tomcat 开发环境【转】
    JBoss和Tomcat版本、及Servlet、JSP规范版本对应一览 【转】
    P1955 [NOI2015]程序自动分析 && 离散化学习 && lower_bound学习
    P1604 B进制星球
    [OI
    [OI
    Aiyi's Code Style for OI
    POJ1186 方程的解数
    [Daily Life]百首好歌
  • 原文地址:https://www.cnblogs.com/sevenun/p/6427484.html
Copyright © 2011-2022 走看看