zoukankan      html  css  js  c++  java
  • centos 安装 apache

    跟新:(可选) yum -y update

    #netstat -an | grep 80 (检查端口是否被占用)

    # yum install httpd httpd-devel  或者 yum -y install httpd httpd-manual httpd-devel mod_ssl mod_perl mod_auth_mysql

    # systemctl enable httpd.service (开机自启动设置)

    # systemctl list-unit-files | grep httpd (查看是否开机自启动)

    # systemctl start httpd.service (启动服务)

    # curl http://127.0.0.1 (检查是否成功)

    =============================

    Apache配置文件:/etc/httpd/conf/httpd.conf (可配置,网站目录,日志目录等)
    Apache配置目录,其他配置文件目录:/etc/httpd/conf.d/
    Apache网站根目录:/var/www/html/
    Apache日志文件目录:/var/log/httpd
     

    防火墙中打开 80 端口: 

    # firewall-cmd --zone=public --add-port=80/tcp --permanent (持久化开启80端口)

    # firewall-cmd –reload 

    在浏览器输入公网地址:http://ip/

    ------------------------

    其他补充知识:

    查看版本: firewall-cmd --version

    显示状态: firewall-cmd --state

    查看所有打开的端口: netstat -anp

    开启防火墙 systemctl start firewalld

    关闭防火墙 systemctl stop firewalld

    查询指定端口是否已开

       firewall-cmd --query-port=80/tcp

    systemctl disable firewald.service (永久关闭防火墙)

    systemctl enable firewald.service (永久开启防火墙)

    systemctl start httpd.service #启动apache

    systemctl stop httpd.service #停止apache

    systemctl restart httpd.service #重启apache

    systemctl enable httpd.service #设置apache开机启动

     
  • 相关阅读:
    2.6.2.MySQL主从复制的原理
    2.4.5 MySQL InnoDB重做与回滚介绍
    PRML读书笔记_绪论曲线拟合部分
    python3_字符串
    PRML读书笔记_绪论
    python3_列表、元组、集合、字典
    linux_软件安装
    shell获取帮助
    linux_查看磁盘与目录容量
    linux_压缩解压命令(zip/tar)
  • 原文地址:https://www.cnblogs.com/Sam-2018/p/centos7-apache.html
Copyright © 2011-2022 走看看