zoukankan      html  css  js  c++  java
  • nginx_php---py安装脚本

    vim nginx_php.py
    i
    # -*- coding: utf-8 -*-
    import os,time
    def create__file(file_path,msg):
    f=open(file_path,"a")
    f.write(msg)
    f.close
    i = os.system('rm -rf php-fpm')
    while i == 0:
    print('php-fpm.tar.gz文件不存在,终止执行')
    os.system('yum install -y lrzsz')
    os.system('rz -E')
    i =+ 1

    print(' -----------------6秒后安装nginx服务-------------------------')
    time.sleep(6)
    print(' ----------------------删除nginx-----------------------------')
    Nginx=os.system("yum remove nginx -y")

    print(' ------------------创建仓库------------------')
    repo='''[nginx-stable]
    name=nginx stable repo
    baseurl=http://nginx.org/packages/centos/$releasever/$basearch/
    gpgcheck=1
    enabled=1
    gpgkey=https://nginx.org/keys/nginx_signing.key
    module_hotfixes=true
    '''

    create__file('/etc/yum.repos.d/nginx.repo',repo)

    print(' -----------------安装nginx程序---------------------')
    run=os.system('yum clean all') #&&yum makecache
    if run == 0 :
    try:
    os.system('yum install -y nginx')
    print(' ---------------安装完毕--------------')
    except Exception as e:
    print(e)
    print(' -----------------6秒后安装php服务-------------------------')
    time.sleep(6)
    print(' ----------------------删除php-----------------------------')
    Nginx=os.system("yum remove php-mysql* php php-fpm php-common")

    print(' ------------------安装第三方仓库------------------')
    os.system('yum localinstall -y http://mirror.webtatic.com/yum/el7/webtatic-release.rpm')
    print(' -----------------安装php程序---------------------')
    os.system('tar zxf php-fpm.tar.gz')
    try:
    os.system('yum localinstall -y php-fpm/*')
    print(' ---------------安装完毕--------------')
    except Exception as e:
    print(e)
    else:
    print(' -----------重启服务并加入开机运行-----------')
    os.system('systemctl start nginx php-fpm')
    os.system('systemctl enable nginx php-fpm')
    print()
    print(' -----------查看端口---------')
    os.system("netstat -lntup|egrep '80|9000'")
  • 相关阅读:
    Servlet的建立以及配置使用
    maven 安装 及其 创建
    错误总结
    使用分层实现业务处理
    JSP数据交互(三)
    JSP数据交互(二)
    JSP数据交互(一)
    动态网页开发基础
    记录mysql编码问题
    .net core 2.0 升级 2.1 访问mysql出现bug解决
  • 原文地址:https://www.cnblogs.com/Leaders543/p/12515068.html
Copyright © 2011-2022 走看看