Ubuntu 14 and LAMP can't access WordPress website

0

I've installed LAMP under Ubuntu 14, placed a copy of my WordPress folder files under the /lampstack-5.6.30-0/apache2/htdocs/wordpress/ folder, started LAMP Apache, MySQL...yet each time I try to reach localhost/wordpress/ I get routed automatically to localhost:8888/wordpress/ and get error message

This site can’t be reached
localhost refused to connect.

I've tried many times to go to localhost:8080/wordpress or localhost/wordpress but I get routed back to localhost:8888/wordpress and see the error message shown above. Can someone please tell me what I might be missing here/ doing wrong? Thanks

Update 1:

Results of sudo netstat -lntp

Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
tcp        0      0 127.0.0.1:2015          0.0.0.0:*               LISTEN      1348/expressvpnd
tcp        0      0 127.0.0.1:27017         0.0.0.0:*               LISTEN      1205/mongod     
tcp        0      0 127.0.0.1:3306          0.0.0.0:*               LISTEN      4117/mysqld.bin 
tcp        0      0 127.0.0.1:28017         0.0.0.0:*               LISTEN      1205/mongod     
tcp        0      0 127.0.1.1:53            0.0.0.0:*               LISTEN      1924/dnsmasq    
tcp        0      0 127.0.0.1:631           0.0.0.0:*               LISTEN      2095/cupsd      
tcp6       0      0 :::8080                 :::*                    LISTEN      4277/httpd.bin  
tcp6       0      0 ::1:631                 :::*                    LISTEN      2095/cupsd      
tcp6       0      0 :::8443                 :::*                    LISTEN      4277/httpd.bin  

MChan

Posted 2017-02-01T09:13:34.033

Reputation: 251

1Could you show result of: sudo netstat -lntp ? – Alex – 2017-02-01T10:04:55.743

@Alex Thanks for your reply, I've updated my question with the results of sudo netstat -lntp Thanks – MChan – 2017-02-01T11:02:13.473

That looks like your apache configured to listen only on IPv6 addresses and there no appropriate IPv6 record in /etc/hosts for localhost. – Alex – 2017-02-01T12:56:46.703

Answers

-1

Please try using 127.0.0.1:8080/wordpress instead and it should work. I've tried it here on my machine and I can access LAMP websites using the URL 127.0.0.1

MKM

Posted 2017-02-01T09:13:34.033

Reputation: 114

Welcome to Super User! While this snippet may address the question, including an explanation of how and why this solves the problem would really help to improve the quality of your post. Remember that you are answering the question for readers in the future, not just the person asking now! Please [edit] your answer to add explanation, and give an indication of what limitations and assumptions apply.

– Toby Speight – 2017-02-02T11:16:47.713

0

Alright so this has driven me mad for weeks, but I've finally figured it out.

Mysql does not have permission to read and write unless you add it to the www-data group. When I tested this, I just made an html file called index.html and pointed apache to it, which worked fine, but once i used wordpress (or joomla), it died, so the problem had to be either in php or Mysql.

When mysql is installed, it is given the username mysql. This needs to be given some permissions over the wordpress files itself. PHP on the other hand is given a username, so if you select your own username, this will have to be added to the group as well.

When you set permissions on your wordpress folder, you give ownership and group permissions to www-data. Personally I changed mine to have the owner as my username on the machine, and www-data as the group. Now the problem is, www-data is an empty group.

You need to add both mysql and www-data (the username) to www-data (the group). You can do that with the command
sudo adduser mysql www-data
sudo adduser www-data www-data
sudo adduser (yourusername) www-data

Now, assuming you gave permissions to the folders earlier, you should now be able to access this site externally. If not, try either
sudo chmod -R 775 /var/www/(folder) *or sudo chmod -R 755 /var/www/(folder)

Malevolence

Posted 2017-02-01T09:13:34.033

Reputation: 1