架构师的成长之路初片~LNMP

1:装包

1.1基本包) vim 

net-tools   

psmisc   

gcc                        //编译工具

pcre-devel              //依赖包,可让nginx支持正则

openssl-devel         //支持搭建ssl(加密)技术的网站

2:装nginx

tar  -xf   nginx-...

cd nginx....

./configure  --prefix=/usr/local/nginx

--with-http_ssl_module

--user=nginx

编译并且安装: make && make install 

目录功能:

html :网站页面存放位置

conf : 主配置文件

sbin : 存放主程序

logs : 存放日志

创建用户:

useradd  -s /sbin/nologin   nginx

启服务,关防火墙

/usr/local/nginx/sbin/nginx

systemctl stop firewalld

装mysql   and  php 包

mariadb  mariadb-server  mariadb-devel

php   php-fpm   php-mysql

修改nginx主配置文件,让他开启php服务

打开nginx配置文件,第65到71行去掉注释,69行不用去

        location ~ .php$ {                               //~是使用正则表达式,匹配以.php结尾

            root           html;

            fastcgi_pass   127.0.0.1:9000;       //一旦用户访问了.php结尾的文件,就让nginx找后台的php-fpm(端口号9000)

            fastcgi_index  index.php;

        #    fastcgi_param  SCRIPT_FILENAME  /scripts$fastcgi_script_name;

            include        fastcgi.conf;                        //这里需要修改名称

        }

sbin/nginx -s reload    //重新加载nginx配置文件

vim /etc/php-fpm.d/www.conf   //php-fpm相关的配置文件,此处

仅查看,无需修改

listen = 127.0.0.1:9000  //此处配置决定了php-fpm服务针对什么ip与

什么端口

pm.start_servers = 5  //一上来开启的进程数量,pstree可以查

看php-fpm(fastCGI)的进程数量,如果修改了需要重启php-fpm服务

pm.max_children = 50   //开启的fastCGI进程最大数量

原文地址:https://www.cnblogs.com/ahaocloud/p/14418429.html