zoukankan      html  css  js  c++  java
  • linux 搭建配置 lnmp搭建

    关系 防火墙 service iptables stop
    设置防火墙不在启动 setup firewall -> run tool->disabled->ok
    查看ip ifconfig
    ping ip
    连接ftp winscpportable.exe
    上传资料 上传到 /usr/local/src 下

    分配权限 cd /usr/local/src/
    chmod +x ./install*

    执行intallall

    管理 nginx
    /usr/local/nginx
    service nginx start|restart|stop

    service nginx reoad //重新加载配置文件

    修改配置文件:/usr/local/nginx/conf/nginx.conf

    管理 mysql
    /usr/local/mysql
    service mysqld start|restart|stop
    连接mysql : mysql
    修改配置文件: /etc/my.cnf
    php
    监听:9000
    /usr/local/php
    启动: /usr/local/php/sbin/php-fpm &
    修改配置文件:/usr/local/php/etc/php.ini [如果修改了要重启php]

    查看php是否启动:

    ps -aux | grep php //匹配搜索


    有3个进程,就说明已经启动了

    关闭php //-15 表示让它自己关闭 //-9表示强制关闭
    先通过上面的指令查出php的master 进程的pid是多少
    再通过kill 指令关闭 : kill -15 4450


    --------------------
    设置mysql 的用户名和密码

    先查看当前有哪些账号: use mysql; select host,user,password from user;
    删除空的 用户名
    delete from user where user = '';
    delete from user where host <> 'localhost'; // <>不等于

    设置密码,加密密码
    update user set password =password('1234');

    只保留一个有root 即可,现在再执行一个命令,让这些操作马上生效。
    方法1 :重启
    方法2: 执行 flush privileges;

    扩展:如果忘记密码,怎么办?
    修改配置文件,关闭权限系统,然后就可以不使用用户名和密码直接进入了,
    再执行前面的指令,重新设置密码,然后重新启动
    vim /etc/my.cnf
    添加一行
    skip-grant-tables
    重启mysql 就可以了


    ---------------------------------------
    在nginx 中配置虚拟主机

    worker_processes 8;
    worker_connecttions 65535; //最大连接数 50万并发量每秒,受到linux系统限制
    查看linux对系统的限制:
    ulimit -a

    打开限制:ulimit -SHn 65535 //在配置高并发的时候一定要打开

    属于【linux的内核优化】

    ----------------------
    虚拟主机的配置
    http
    {
    #每一个server就是一个虚拟主机
    Server{
    Listen:80;
    Root: /www/www.39.com ; #根目录
    Server_name: www.39.com ; #网站域名
    }

    Server{
    Listen:80;
    Root: /www/www.35.com ; #根目录
    Server_name: www.35.com ; #网站域名
    loation ~ .*.php?$
    {
    fastcgi_pass 127.0.0.1:9000;
    fastcgi_index index.php
    include fcgi.conf;
    }
    }
    }

    默认php不能执行,需要再添加一段配置
    loation ~ .*.php?$
    {
    fastcgi_pass 127.0.0.1:9000;
    fastcgi_index index.php
    include fcgi.conf;
    }

    如果要运行tp框架 ,是pathinfo模式,就要用另一个配置【网上找】

    location ~ .+.php($|/) {
    set $script $uri;
    set $path_info "/";
    if ($uri ~ "^(.+.php)(/.+)") {
    set $script $1;
    set $path_info $2;
    }

    fastcgi_pass 127.0.0.1:9000;
    fastcgi_index index.php?IF_REWRITE=1;
    include fcgi.conf;
    fastcgi_param PATH_INFO $path_info;
    fastcgi_param SCRIPT_FILENAME $document_root/$script;
    fastcgi_param SCRIPT_NAME $script;
    }

    添加权限
    chmod -R 777 ./src/ 为所有文件添加权限

    世上无难事,只怕有心人......
  • 相关阅读:
    [BZOJ 3774]最优选择
    [HDU 6598]Harmonious Army
    [SP2063]MPIGS-Sell Pigs
    [CF103E]Buying Sets
    [LOJ 6058]百步穿杨
    [CQOI2014]危桥
    李宏毅机器学习课程笔记-3.梯度下降精讲
    李宏毅机器学习课程笔记-2.5线性回归Python实战
    李宏毅机器学习课程笔记-2.4交叉验证
    李宏毅机器学习课程笔记-2.3欠拟合与过拟合
  • 原文地址:https://www.cnblogs.com/gooderic/p/5944241.html
Copyright © 2011-2022 走看看