• centos 切换nginx跟apache环境


    启动nginx的启动

    nginx -c /etc/nginx/nginx.conf

    停止nginx的方法切换到apache、

    pkill -9 nginx

    直接杀死运行中的程序,关闭nginx
    service httpd start启动apache
    Centos下安装Lamp和vsftpd、redis

    yum安装httpd和php、mysql服务

    1: yum search httpd            //搜索httpd开头的软件包
    2: yum install httpd.x86_64   //找到apache 对应的软件包名 Apache HTTP Server,安装
    3: yum -y install mysql-server mysql php php-mysql php-xml php-gd php-mbstring  //安装 mysql  php 及其扩展
    4: service mysqld restart  //启动mysql    mysql -uroot -p  空   show databases; 查看数据表
    5: iptables -F   //清空防火墙
    6: service iptables save  //保存防火墙规则
    7: service iptables stop  //关闭防火墙
    8: apachectl restart  //这时候会报错 
    9: vi /etc/httpd/conf/httpd.conf    //配置httpd
    10::set nu  //显示行号   
    11: :/ServerName  //查找ServerName
    12: :1  回到最顶行
    13: 去掉 ServerName www.example.com:80   前面的#     保存 
    14: serveice httpd restart 重启 apache 
    15: 访问ip 查看apache启动情况
    16: cd /var/www/html   //进入php默认目录
    17: vi index.php    //创建PHP文件  保存 刷新查看信息
    18:service mysqld start    启动mysql


    有时想知道nigix是否在正常运行,需要用linux命令查看nginx运行情况

    执行命令:

    ps -A | grep nginx
    如果返回结果的话,说明有nginx在运行,服务已经启动。

    如果不怕nginx关闭的话。也可以执行:

    service nginx restart

    把nginx服务重启,在重启时,也可以看到具体有没有什么地方出错。

    路径启动,默认在/usr/local/nginx/sbin/nginx
    启动:/usr/local/nginx/sbin/nginx
    平滑重启:/usr/local/nginx/sbin/nginx -s reload
    停止:/usr/local/nginx/sbin/nginx -s stop
    重启:/usr/local/nginx/sbin/nginx -s restart

    重启nginx
    # service nginx restart

    
    

    查看Apache是否被安装:

    [root@asg11 ~]# find / -name 'httpd'
    /etc/sysconfig/httpd
    /etc/httpd
    /etc/logrotate.d/httpd
    /etc/rc.d/init.d/httpd
    /var/run/httpd
    /var/log/httpd
    /var/lock/subsys/httpd
    /usr/sbin/httpd
    /usr/lib64/httpd

    由此确定Apache被安装的地方是/etc/httpd

    查看Apache版本

    首先进入httpd所在目录
    [root@asg11 ~]# cd /etc/httpd

    进而查看版本
    [root@asg11 httpd]# httpd -v
    Server version: Apache/2.2.15 (Unix)
    Server built:   Aug 13 2013 17:29:28

    停止httpd
    [root@asg11 httpd]# service httpd stop
    Stopping httpd: [  OK  ]

    启动httpd
    [root@asg11 httpd]# service httpd start
    Starting httpd: [  OK  ]

    用浏览器访问试试:

    
    

     

    
    


    [root@asg11 httpd]#

    
    

    Apache的重要配置文件httpd.conf的位置在/etc/httpd/conf/httpd.conf

    
    

    [root@asg11 conf]# pwd
    /etc/httpd/conf
    [root@asg11 conf]# ls
    httpd.conf  magic
    [root@asg11 conf]#



  • 相关阅读:
    del
    sublime右键菜单,anaconda设置
    全概率公式、贝叶斯公式推导过程
    python数据结构之链表(一)
    关于panda中dataframe的与&运算*(stackoverflow高票答案)
    转载:python 日期,季度,年份
    商业模式画布
    互联网思维
    互联网思维
    战略品牌管理_1
  • 原文地址:https://www.cnblogs.com/yszr/p/8149272.html
Copyright © 2020-2023  润新知