WTH: Tomcat expert

Discussion in 'Site & Server Administration' started by Hipto, Oct 31, 2009.

  1. #1
    Hey guys I need help changing Tomcat default port 8080 to 80. If you think you can help, PM me. Thanks
     
    Hipto, Oct 31, 2009 IP
  2. Bohra

    Bohra Prominent Member

    Messages:
    12,573
    Likes Received:
    537
    Best Answers:
    0
    Trophy Points:
    310
    #2
    1. Open the folder tomcat\conf on your computer

    2. Now with a text editor you have to open and modify server.xml. Here you have to identify the following line (line 184) and you modify it so that changes from:
    <Http10Connector port="8080"
    secure="false"
    maxThreads="100"
    maxSpareThreads="50"
    minSpareThreads="10" />

    to:

    <Http10Connector port="80"
    secure="false"
    maxThreads="100"
    maxSpareThreads="50"
    minSpareThreads="10" />

    3. Startup the web server and access it now using:

    http://localhost/
     
    Bohra, Oct 31, 2009 IP
  3. Hipto

    Hipto Peon

    Messages:
    939
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #3
    I'm using VPS. The problem is i can't located server.xml file
     
    Hipto, Oct 31, 2009 IP
  4. Bohra

    Bohra Prominent Member

    Messages:
    12,573
    Likes Received:
    537
    Best Answers:
    0
    Trophy Points:
    310
    #4
    Well just try using the find command

    find -name server.xml
     
    Bohra, Oct 31, 2009 IP
  5. Hipto

    Hipto Peon

    Messages:
    939
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Doesn't work

    root@kohproxy [~]# find -name server.xml
    root@kohproxy [~]#
     
    Hipto, Oct 31, 2009 IP
  6. Bohra

    Bohra Prominent Member

    Messages:
    12,573
    Likes Received:
    537
    Best Answers:
    0
    Trophy Points:
    310
    #6
    Which OS are you on ??
     
    Bohra, Oct 31, 2009 IP
  7. Hipto

    Hipto Peon

    Messages:
    939
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #7
    Centos 5.3
     
    Hipto, Oct 31, 2009 IP
  8. Bohra

    Bohra Prominent Member

    Messages:
    12,573
    Likes Received:
    537
    Best Answers:
    0
    Trophy Points:
    310
    #8
    Try if the file is here /usr/tomcat/server.xml
     
    Bohra, Oct 31, 2009 IP
  9. Hipto

    Hipto Peon

    Messages:
    939
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #9
    Nope. Not there either. I rebuilt my apache with easyapache and added tomcat before recompiling, that's all
     
    Hipto, Oct 31, 2009 IP
  10. Bohra

    Bohra Prominent Member

    Messages:
    12,573
    Likes Received:
    537
    Best Answers:
    0
    Trophy Points:
    310
    #10
    Well try this path

    /usr/local/jakarta/tomcat/conf/server.xml
     
    Bohra, Oct 31, 2009 IP
  11. Hipto

    Hipto Peon

    Messages:
    939
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #11
    It's there. Now I'll have to restart tomcat. What command should i use? /etc/init.d/tomcat restart didn't work
     
    Hipto, Oct 31, 2009 IP
  12. chandan123

    chandan123 Prominent Member

    Messages:
    11,586
    Likes Received:
    578
    Best Answers:
    0
    Trophy Points:
    360
    #12
    or u can use this

    /usr/local/jakarta/tomcat/shutdown.sh

    /usr/local/jakarta/tomcat/startup.sh ( if these shell script exists in that folder )
     
    chandan123, Oct 31, 2009 IP
  13. Hipto

    Hipto Peon

    Messages:
    939
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #13
    I couldn't find the above, hence I changed

    <Connector port="8080" maxHttpHeaderSize="8192"
    maxThreads="150" minSpareThreads="25" maxSpareThreads="75"
    enableLookups="false" redirectPort="8443" acceptCount="100"
    connectionTimeout="20000" disableUploadTimeout="true" />

    to

    <Connector port="80" maxHttpHeaderSize="8192"
    maxThreads="150" minSpareThreads="25" maxSpareThreads="75"
    enableLookups="false" redirectPort="8443" acceptCount="100"
    connectionTimeout="20000" disableUploadTimeout="true" />

    I rebooted my VPS, now it's not working at all. Will have to chnage back to 8080 :/
     
    Hipto, Oct 31, 2009 IP
  14. Hipto

    Hipto Peon

    Messages:
    939
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #14
    If someone can do it on my behalf. PM me your msn. Thx
     
    Hipto, Nov 1, 2009 IP
  15. Bohra

    Bohra Prominent Member

    Messages:
    12,573
    Likes Received:
    537
    Best Answers:
    0
    Trophy Points:
    310
    #15
    Well is there anything else running on port 80 already if yea it wont work for sure..
     
    Bohra, Nov 1, 2009 IP
  16. chandan123

    chandan123 Prominent Member

    Messages:
    11,586
    Likes Received:
    578
    Best Answers:
    0
    Trophy Points:
    360
    #16
    probably apache is running already with that port as he is using apache
     
    chandan123, Nov 1, 2009 IP
  17. Bohra

    Bohra Prominent Member

    Messages:
    12,573
    Likes Received:
    537
    Best Answers:
    0
    Trophy Points:
    310
    #17
    Yea i doubt any other program uses port 80 by default so first close apache or uninstall it and then try
     
    Bohra, Nov 1, 2009 IP
  18. sahabcse

    sahabcse Well-Known Member

    Messages:
    272
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    140
    #18
    Stop the apache service using below command

    #/etc/init.d/httpd stop

    Then search is there any apache process are running

    #ps -ax | grep httpd

    None means leave it otherwise kill the httpd process

    #killall -9 httpd

    Then change the port number in the file server.xml

    For finding the file

    #locate server.xml
     
    sahabcse, Nov 1, 2009 IP
  19. Hipto

    Hipto Peon

    Messages:
    939
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #19
    Hmmm if i close apache will my normal site runs :/

    I've got other site using the same server too
     
    Hipto, Nov 1, 2009 IP
  20. Bohra

    Bohra Prominent Member

    Messages:
    12,573
    Likes Received:
    537
    Best Answers:
    0
    Trophy Points:
    310
    #20
    lol if u want to run tomcat on port 80 there is no other option u have to close apache
     
    Bohra, Nov 1, 2009 IP