Install Apache to CentOs 7 installed but not showing in the browser

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.

3
задан 7 April 2018 в 13:41
2 ответа

CentOS 7 по умолчанию использует firewalld. Вы можете удалить это и установить iptables.

Однако, если вы хотите сделать это способом firewalld, выполните следующие команды:

sudo firewall-cmd --add-service=http
sudo firewall-cmd --add-service=https
7
ответ дан 3 December 2019 в 05:02

Делайте все с нуля, а не полагайтесь только на команды.

Проверьте, запущен ли apache

pgrep apache

Убедитесь, что apache прослушивает, используя:

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

Если нет, проверьте систему и журналы apache для любых ошибок. (например, возможной причиной могут быть настройки SELinux: на данный момент отключите его в / etc / selinux / config)

Если работает, то следующее может дать вам некоторые подсказки:

iptables -nL

Возможно, вы отключили его порт во время установки .

Убедитесь, что вы не связаны каким-либо NAT или перенаправлением портов на стороне центра обработки данных. Обратитесь к их администраторам.

Обновление №1:

Это быстрое решение:

    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
1
ответ дан 3 December 2019 в 05:02

Теги

Похожие вопросы