skip to Main Content

I have installed Apache GUI on Linux Debian in the following directory

/usr/local/apachegui/ApacheGUI/bin 

by the following instruction as shown on this webpage:
https://www.howtoforge.com/tutorial/ubuntu-apache-gui/

At the end of the instruction, it’s says run the following command:

sudo ./run.sh

when I run the above command I get the following output but with an error

./run.sh: 1: [: -ne: unexpected operator

Bottom of the terminal window its mention tomcat started and as in above mention tutorial webpage claims after running run.sh command

Your ApacheGUI is now starting and listening on port 9999.
Next, open your web browser and type the URL >http://your-server-ip:9999/ApacheGUI. You will >be redirected to the following page (ApachiGUI home page)

In my case when I am typing the above URL with my IP address or localhost my Chrome browser print: output site can not be reach

So I searched to check if port 9999 is enabled and listening in my case I was unable to see port 9999 in my list of ports so ran the following commands and the terminal window didn’t produce any output from here I assumed port 9999 is close

pi@Home:~ $ ss -na | grep :9999

After using the above command terminal window return back to ip@home:$

now I open a separate terminal window and ping port 9999 and as result, This terminal window hang now it is clear the port 9999 is not open in my server so to open the close port I run the following command

Open port command:

sudo iptables -A INPUT -p tcp --dport 9999 -j ACCEPT

To update the firewall rules, I restart the iptables service

sudo iptables -L

output:

pi@Home:~ $ sudo iptables -L
Chain INPUT (policy ACCEPT)
target     prot opt source               destination         
ACCEPT     tcp  --  anywhere             anywhere             tcp dpt:9999

Chain FORWARD (policy ACCEPT)
target     prot opt source               destination         

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination 

Now I check again a list of open ports on my server and I still can’t see port 9999

After taking all these steps executed following command:

pi@Home:/usr/local/apachegui/ApacheGUI/bin $ ./run.sh

Output:

Using CATALINA_BASE: /usr/local/apachegui/ApacheGUI/tomcat Using
CATALINA_HOME: /usr/local/apachegui/ApacheGUI/tomcat Using
CATALINA_TMPDIR: /usr/local/apachegui/ApacheGUI/tomcat/temp Using
JRE_HOME: /usr Using CLASSPATH:

/usr/local/apachegui/ApacheGUI/tomcat/bin/bootstrap.jar:/usr/local/apachegui/ApacheGUI/tomcat/bin/tomcat-juli.jar
Tomcat started.

look like the initial error is resolved but I am still unable access ApacheGUI from my browser still unable to resolve the error mention above can anyone suggest what is the solution to this problem?

2

Answers


  1. Chosen as BEST ANSWER

    By executing following tests you will learn port testing and port configuration and at the end of these test you will be able to find out either problem exist within your Server ports or you have to check the setting of your browser. In my case I have taken an unintentional long route, I set my testing plan into three sections as follow

    Server Ports and Browser

    If you ever experience the same issue my advise is to troubleshoot

    Server Browser and then test Ports

    By executing tomcat/bin/startup.sh it does start the server successfully just like run.sh (as mention in Question and given answer above) but the browser was still unable to load the localhost:9999/ApacheGUI index page because the server's initial error

    ./run.sh: 1: [: -ne: unexpected operator

    was resolve (as shown in question) but the browser was still unable to load the GUI page so for this reason just to find out if there is a problem with port 9999 itself or there is something else causing localhost not to communicate with the browser via port 9999 I have carried out following tests:

    I believe the following information is suitable for a tester who wants to troubleshoot ports but if you think there is nothing wrong with your ports and the problem may lies with the browser then visit the following link Where I had the same problem with port 8080 and I overcome this issue by modifying browser settings:

    https://stackoverflow.com/questions/66524719/tomcat10-home-page-can-not-load-by-typing-localhost8080-error-err-connection-r
    

    Reboot my server and execute the following command in terminal

    tomcat/bin/startup.sh

    output shows

    Tomcat started

    With this output, I know ApacheGUI is installed and the server is up and running.

    Q: if the server is running so whey localhost:9999/ApacheGUI index page is unable to load?

    let's test port 9999 and take the following steps to check either it's port on your machine causing this error or it's something else

    StepNO:1

    pi@Home:~ $ nc -vz 192.168.0.16 9999
    Connection to 192.168.0.16 9999 port [tcp/*] succeeded!
    

    StepNO:2 type command on Linux terminal to test port 9999 (Enter)

    pi@Home:~ $ sudo ls | nc -l -p 9999
    
    • (Cursor start flashing with no output)

    StepNo:3 Then turn ON Window computer and open PuTTY client

    Establish SSH connection from window machine by typing the following credentials in PuTTY Client interface:

    Server: 192.168.0.16 port 9999 (Press Enter)

    if port 9999 is open successfully you will get the following results

    Linux Server Terminal (StepNO:2) Where cursor was flashing start responding to Client request and print following line (where the cursor is still flashing):

    SSH-2.0-PuTTY_Release_0.74

    StepNO:4 Open a new terminal window and typed another command to make sure port 9999 is definitely open and responding (Linux Server terminal in StepNO:2 still open)

    pi@Home:~ $ nmap -p 9999 192.168.0.16
    

    Output:

    Starting Nmap 7.70 ( https://nmap.org ) at 2021-03-05 23:44 GMT Nmap scan report for 192.168.0.16 Host is up (0.00049s latency).

    PORT STATE SERVICE 9999/tcp open abyss

    Nmap done: 1 IP address (1 host up) scanned in 0.26 seconds

    This stage confirmed I have successfully open port 9999 and the port is responding to TCP protocols

    StepNO:5

    in the same Linux server terminal (stepNO:2) I type the following command again:

    sudo ls | nc -l -p 9999 (Enter)

    • (Cursor start flashing)

    Now I have open the browser and type ApacheGUI URL

    192.168.0.16:9999/ApacheGUI (Enter)

    Linux server terminal from StepNO:2 where the cursor is flashing start responding to URL request from the browser and print the following lines in the terminal window:

    Output:

    GET /ApacheGUI/ HTTP/1.1 Host: 192.168.0.16:9999 Connection: keep-alive Upgrade-Insecure-Requests: 1 User-Agent: Mozilla/5.0 (X11; Linux armv7l) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.197 Safari/537.36 Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,/;q=0.8,application/signed-exchange;v=b3;q=0.9 Accept-Encoding: gzip, deflate Accept-Language: en-US,en;q=0.9

    But: my ApacheGUI index page still unable to load and showing the following error message

    This site can’t be reached192.168.0.16 refused to connect. Try:

    Checking the connection Checking the proxy and the firewall ERR_CONNECTION_REFUSED

    At this stage, I am 100% sure that my installed server is up and running. Port 9999 in my server is open and functional so there is nothing else that can cause this error except the browser so I have followed the step to tune my browser setting as described in answer to the following link:

    https://stackoverflow.com/questions/66524719/tomcat10-home-page-can-not-load-by-typing-localhost8080-error-err-connection-r
    

    Result: Successful connection ApacheGUI index page finally loaded to the browser.


  2. The run.sh file is a badly written shell script with content:

    if [ $UID -ne 0 ]; then
      sudo ../tomcat/bin/startup.sh
      exit
    fi
    
    exec ../tomcat/bin/startup.sh
    

    Just execute tomcat/bin/startup.sh. This script can fail in many ways:

    • there is no shebang (#!interpreter_name), so it is executed using /bin/sh or whatever the default shell is,
    • UID is not a POSIX variable (cf. this question), so the result is blank and test ([) only sees -ne 0. Usually in such cases the variable should be quoted or tested if it is not empty,
    • the path ../tomcat/bin/startup.sh is relative to the current directory, not the directory of the script.
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search