Linux搭建php网站
安装PHP、Nginx和PHP-FPM
sudo apt-get install php
sudo apt-get install nginx
sudo apt-get install php7.2-fpm #(此处应用php版本)配置Nginx和PHP-FPM
查看php-fpm配置
`cd /etc/php/7.2/fpm/pool.d`
在www.conf配置文件找到
`listen = /run/php/php7.2-fpm.sock` 或 `listen = 127.0.0.1:9000`
判断怎么使服务器连接到PHP-FPM
注:当Nginx和PHP-FPM在一个主机上时,使用sock文件那种方式效率更高一些配置Nginx
sudo vim /etc/nginx/nginx.conf 添加server server { listen 8000; # 设置监听端口号 用于http协议 server_name 49.234.78.157; # 设置对外访问入口,可以是域名可以是IP地址 charset UTF-8; # 设置访问的语言编码 root /home/ubuntu/git/django_project/WMXZ.WANG/; # 默认网站根目录 location / { # 前端资源配置 index index.php; try_files $uri $uri/ index.php?$query_string; } location ~ \.php$ { # 后端配置,到index.php fastcgi_pass unix:/run/php/php7.2-fpm.sock; # 此处要php-fpm的配置保持一致 fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; } }
相关推荐
zyyjay 2020-11-09
xuebingnan 2020-11-05
samtrue 2020-11-22
stefan0 2020-11-22
yifangs 2020-10-13
songshijiazuaa 2020-09-24
hebiwtc 2020-09-18
天步 2020-09-17
83911535 2020-11-13
whatsyourname 2020-11-13
zhouyuqi 2020-11-10
Noneyes 2020-11-10
mathchao 2020-10-28
王志龙 2020-10-28
wwwsurfphpseocom 2020-10-28
diskingchuan 2020-10-23
savorTheFlavor 2020-10-23