Install LAMP on a remote server

2

I'm trying to install LAMP on a server and I'm doing this remotely.

These are what I did so far:

1) ssh admin@address.net [Ubuntu 12.10 server]
2) sudo apt-get install lamp-server^

The installation seems successful, but I CAN'T access http://address.net/
I'm sure apache2 is running.
Also, I've checked the /var/www/ folder and there, exists an index.html file.
So I'm expecting a "It works!" page at least upon accessing http://address.net/ on my browser.

Did I miss to configure something?

Thanks so much.

Mae B

Posted 2012-12-20T06:22:29.550

Reputation: 21

Be more specific on "can't access". What does your browser say? e.g. Connection refused, Connection timed out, Connection reset. What do Apache logs say? Any firewall running (check iptables -L -n -v). – gertvdijk – 2012-12-20T09:40:38.250

Thanks for the response. The error I'm getting is: Oops! Google Chrome could not connect to address.net. ALSO I've checked the apache2 access.log and it's EMPTY. Maybe a firewall is blocking the connection to the apache server? – Mae B – 2012-12-20T12:41:13.310

1Resolved this. It's a firewall issue. Just enabled port 80 on firewall. Thanks again! – Mae B – 2012-12-20T15:29:04.927

Answers

0

First, I used lsof -i command to check for the internet sockets currently opened.

$lsof -i
COMMAND PID USER FD.....
ssh 9200 admin ….....

I saw that only ssh was open. No httpd running.
I checked firewall status and noticed only port 22 was enabled.

$sudo ufw status

Status: active
To Action From
-- ------ ----
22 ALLOW Anywhere
22 ALLOW Anywhere (v6)

So I enabled port 80 using this command:
$sudo ufw allow 80

Restarted apache, and tried address.net again. It worked!

Mae B

Posted 2012-12-20T06:22:29.550

Reputation: 21

1

Please check with lsof |grep LISTEN (you may have to install lsof via apt-get) if there are apache processes on port 80/http. If not, check ps aux |grep apache if it runs. If not, try to start it with /etc/init.d/apache2 start and check with lsof again if it runs.

Also make sure that the apache2 process can access the /var/www folder. Check if there are log files for apache. They should be in an apache subfolder of /var.

Explanation:

In reply to your comment on your question:

Could you take a look into /etc/apache2/sites-enabled? There should be at least one file in there. If not, look into /etc/apache2/sites-available, there must be at least one file. If there is use a2ensite filename to enable it. Also check if there is a /etc/apache2/httpd.confand if it exists, what is in it.

Wiste

Posted 2012-12-20T06:22:29.550

Reputation: 123

Resolved this. It's a firewall issue. Just enabled port 80 on firewall. Thanks again! – Mae B – 2012-12-20T15:29:25.097

@user933925 great, you may want to add how you solved it and the way how you found out about it as an answer to your question and mark that as the answer. That way other people with the same problem can use your description to solve the problem for them, too. – Wiste – 2012-12-21T08:37:29.450

First,I used lsof -i command to check for the internet sockets currently opened.I saw that only ssh was open.No httpd running.

$lsof -i COMMAND  PID     USER   FD.. ssh     9200 admin    ….

I checked firewall status and noticed only port 22 is enabled.

$sudo ufw status Status: active

To                         Action      From --                         ------      ---- 22                         ALLOW       Anywhere 22                         ALLOW       Anywhere (v6)

So I enabled port 80 using this command $sudo ufw allow 80

Restarted apache, and tried address.net again. It worked! – Mae B – 2012-12-21T11:26:05.363

@user933925 copy and paste that as a new answer to your question and then mark your answer as solved. – Wiste – 2012-12-21T12:46:40.997