1

I hope someone can help me, I am trying to set up a VPS, i have a small VPS to learn on before i use my main VPS. Ok so, I have installed Apache without any problems and when i try " sudo service httpd status ", I am told that Apache is active and running and everything is fine. but when i go to my IP in the browser, i get told that the browser can not connect, no matter what browser i use. I did a " sudo service firewalld status " and found that i did not have a firewall no such file or folder. I then did " systemctl list-units --type=service " this did not show any firewall at all. this showed up with one problem, "systemd-v...le-setup.service loaded failed failed Setup Virtual Console"

So as i am very new to all this i have no idea what i have done wrong. If anyone knows how to solve this i would be happy. I am using a MacBook Pro and Terminal to connect via SSH I have tried Reinstalling CentOs 7 and starting again but i get the exact same problems. Thank you for all help in advance.

4

CentOS 7 uses firewalld by default. You could remove this and install iptables.

However if you want to do this the firewalld way, run the following commands:

sudo firewall-cmd --add-service=http
sudo firewall-cmd --add-service=https
  • Hello Thank you very much i have tried that, but it did not work. According to the status of a fresh install of my CentOs 7 it has iptables by default and firewalld is not on the system. I have tried everything i can to get this to work and i have tried every trick offered but i still can not get this to work. no matter what i try i can not get apache to show up in the browser unless i disable iptables or if i have tried with firewalld it has to be disabled to view apache test page in the browser. i have to give up as it seems i will never get this done. – zimbert Apr 15 '18 at 10:51
0

Do things from the scratch, rather than depending on the commands only.

Check if apache is running

pgrep apache

Make sure apache is listening using:

netstat -ntap | grep LISTEN | grep ":80"

If not, check system and apache logs for any errors. (e.g. SELinux settings can be a possible cause: set it to disabled in /etc/selinux/config for now)

If works, then the following may give you some clues:

iptables -nL

You might have disabled its port during installation.

Make sure you are not bound by any sort NAT or Port Forwarding at the data center side. Check with their admins.

Update #1:

This is a quick workaround:

    yum install iptables-services
    systemctl start iptables
    systemctl enable iptables
    systemctl disable firewalld
    systemctl stop firewalld
    iptables -P INPUT ACCEPT
    iptables -F
    iptables -A INPUT -m state --state ESTABLISHED -j ACCEPT
    iptables -A INPUT -m state --state RELATED -j ACCEPT
    iptables -A INPUT -p tcp --dport 22 -j ACCEPT
    iptables -A INPUT -p tcp --dport 80 -j ACCEPT
    iptables -A INPUT -p tcp --dport 443 -j ACCEPT # if need
    # add any other port you need, like above
    iptables -P INPUT DROP
    service iptables save
  • HelloIt was the iptables, once i disabled them i was able to see the Apache test page on my ip without a problem, Apache is working well the problem i am having now is that i can not use iptables or firewalld with Apache no matter what i try i get Warnings and Errors. I have reinstalled and started from scratch 30 times now, i had started from scratch about 14 times before i left the message above. – zimbert Apr 8 '18 at 12:48
  • I have tried and tried to set up a VPS i tried for over 20 hours yesterday, I bought courses and read books and googled but no matter what I try I just get errors and warnings. I can get the Apache to work but i can not get either iptables or firewalld to work without errors and yes they are not both on at the same time, as i say i have tried from scratch more than 30 times now. I have checked the ports they are fine not disabled. I have had to give up as I can not find a single tutorial that works without errors. Thank you – zimbert Apr 8 '18 at 12:59
  • edited. plz check if it works for you... – MTG Apr 8 '18 at 12:59
  • Thank you for all that above but i have already tried that in a previous tutorial. the workaround i mean – zimbert Apr 8 '18 at 12:59
  • Ok So reading back i can see that i am not explaining myself very well.I will try an explain exactly what i am trying to do – zimbert Apr 8 '18 at 13:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.