标签:路径 figure margin nload 控制 fast log pcre term
官网:http://nginx.org/
1.下载http://nginx.org/download/nginx-1.14.0.tar.gz
2.查看详情
[zwesy@localhost ~]$ ls -alh | grep nginx drwxr-xr-x. 8 zwesy zwesy 158 4月 17 23:22 nginx-1.14.0
3.编译安装
[zwesy@localhost nginx-1.14.0]$ ./configure --prefix=/usr/local/nginx --with-pcre=/usr/local/pcre-8.42/bin/pcre-config
[zwesy@localhost nginx-1.14.0]$ make
[zwesy@localhost nginx-1.14.0]$ sudo make install
4.nginx启动、重启、关闭
[zwesy@localhost nginx-1.14.0]$ cd /usr/loacl/nginx/sbin/
查看并关闭掉apache 的进程
[zwesy@localhost sbin]$ ps aux |grep httpd
启动nginx
[zwesy@localhost sbin]$ sudo ./nginx
重启
kill -HUP 主进程号或进程号文件路径
或者使用
[zwesy@localhost sbin]$ cd /usr/local/nginx/sbin
[zwesy@localhost sbin]$ sudo ./nginx -s reload
关闭
查询nginx主进程号
ps -ef | grep nginx
从容停止 kill -QUIT 主进程号
快速停止 kill -TERM 主进程号
强制停止 kill -9 nginx
若nginx.conf配置了pid文件路径,如果没有,则在logs目录下
kill -信号类型 ‘/usr/local/nginx/logs/nginx.pid‘
还可通过配置/etc/init.d/nginx文件来控制 参考 https://blog.csdn.net/w1014074794/article/details/51881050
5.配置nginx 的PHP 启动 php-pfm
重命名php-pfm 配置文件使其生效
[zwesy@localhost sbin]$ cd /usr/local/php-7.2.6/etc/
[zwesy@localhost etc]$ sudo mv php-fpm.conf.default php-fpm.conf
[zwesy@localhost etc]$ cd /usr/local/php-7.2.6/etc/php-fpm.d/
[zwesy@localhost php-fpm.d]$ sudo cp www.conf.default www.conf 拷贝一份 ,去掉.default
启动php-pfm
[zwesy@localhost sbin]$ cd /usr/local/php-7.2.6/sbin/
[zwesy@localhost sbin]$ sudo ./php-fpm
检查是否启动成功
[zwesy@localhost sbin]$ ps aux | grep php-fpm
root 4975 0.0 0.0 150940 2708 ? Ss 04:00 0:00 php-fpm: master process (/usr/local/php-7.2.6/etc/php-fpm.conf)
nobody 4976 0.0 0.0 153024 2624 ? S 04:00 0:00 php-fpm: pool www
nobody 4977 0.0 0.0 153024 2624 ? S 04:00 0:00 php-fpm: pool www
zwesy 5071 0.0 0.0 112720 972 pts/0 S+ 04:01 0:00 grep --color=auto php-fpm
nginx处理流程
HTTP--------》Nginx server ---FASTCGI(PHP-FPM)----》PHP解释器
[zwesy@localhost sbin]$ cd /usr/local/nginx/
[zwesy@localhost nginx]$ ll
[zwesy@localhost nginx]$ cd conf/
[zwesy@localhost conf]$ sudo vim nginx.conf
server {
listen 80;
server_name localhost;
#charset koi8-r;
#access_log logs/host.access.log main;
location / {
root html;
index index.html index.htm;
}
location ~ \.php {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
include fastcgi_params;
}
............................................
}
6.测试是否可以和PHP 协同工作,在nginx目录的html下新建一个test.php
[zwesy@localhost nginx]$ cd html/
[zwesy@localhost html]$ sudo vim test.php
参考https://www.cnblogs.com/jecyhw/p/5504855.html
标签:路径 figure margin nload 控制 fast log pcre term
原文地址:https://www.cnblogs.com/zwesy/p/9114652.html