wiki:linux:ubuntu-install-nginx-php-mysql
差别
这里会显示出您选择的修订版和当前版本之间的差别。
两侧同时换到之前的修订记录前一修订版后一修订版 | 前一修订版 | ||
wiki:linux:ubuntu-install-nginx-php-mysql [2019/10/05 17:33] – colin | wiki:linux:ubuntu-install-nginx-php-mysql [2023/01/03 15:25] (当前版本) – 外部编辑 127.0.0.1 | ||
---|---|---|---|
行 14: | 行 14: | ||
sudo apt-get install nginx | sudo apt-get install nginx | ||
- | 查看Nginx版本 | + | 参考 |
- | | + | |
- | Nginx文件语法检测 | + | |
- | nginx -t | + | |
- | Nginx的服务控制操作 | + | |
- | sudo systemctl status nginx | + | |
- | sudo systemctl start nginx | + | |
- | sudo systemctl stop nginx | + | |
- | sudo systemctl restart | + | |
- | ==== 一些网站的配置 ==== | + | ==== 关于php网站的配置 ==== |
DokuWiki网站的Nginx配置 | DokuWiki网站的Nginx配置 | ||
行 34: | 行 27: | ||
以 vim / | 以 vim / | ||
<code xml> | <code xml> | ||
- | | + | # pass the PHP scripts to FastCGI server listening on 127.0.0.1: |
- | # | + | # |
- | location ~ \.php$ { | + | location ~ \.php$ { |
- | include snippets/ | + | include snippets/ |
- | # | + | # |
- | # # With php7.0-cgi alone: | + | # # With php7.0-cgi alone: |
- | # | + | # |
- | # # With php7.0-fpm: | + | # # With php7.0-fpm: |
- | fastcgi_pass unix:/ | + | fastcgi_pass unix:/ |
- | } | + | } |
</ | </ | ||
注意:fastcgi_pass中的php版本应与当前安装的版本一致 | 注意:fastcgi_pass中的php版本应与当前安装的版本一致 | ||
- | ==== 一些关于Nginx的问题 ==== | ||
- | |||
- | 出现类似 nginx depends on nginx-core (>= 1.10.3-0ubuntu0.16.04.4) 的错误的解决办法: | ||
- | |||
- | 首先看是否有 Apache2 服务正在启动,关闭它 | ||
- | |||
- | sudo systemctl stop apache2.service | ||
- | |||
- | 防止 Apache2 服务自启 | ||
- | |||
- | sudo systemctl disable apache2.service | ||
- | |||
- | 重新安装 Nginx | ||
- | |||
- | sudo apt-get install nginx | ||
- | |||
- | 参考 | ||
- | * [[.ubuntu-install-nginx]] | ||
===== 安装 PHP ===== | ===== 安装 PHP ===== | ||
行 88: | 行 63: | ||
sudo systemctl status php7.0-fpm | sudo systemctl status php7.0-fpm | ||
| | ||
- | ==== 安装php模块 ==== | + | ==== 查询、安装php的可选模块 ==== |
查询可用模块 | 查询可用模块 | ||
行 94: | 行 69: | ||
| | ||
安装模块 | 安装模块 | ||
- | apt-get -y install php7.0-mysql php7.0-curl php7.0-gd php7.0-intl php-pear php-imagick php7.0-imap php7.0-mcrypt php-memcache | + | apt-get -y install php7.0-mysql php7.0-curl php7.0-gd php7.0-intl php-pear php-imagick php7.0-imap php7.0-mcrypt php-memcache |
==== 权限 ==== | ==== 权限 ==== | ||
+ | 与 php*.*-fpm 相关的文件权限 | ||
chown -R www-data: | chown -R www-data: | ||
==== 一些问题的解决办法 ==== | ==== 一些问题的解决办法 ==== | ||
- | nginx搭建php提示No input file specified. | + | ** nginx搭建php提示No input file specified.** |
打开fastcgi.conf | 打开fastcgi.conf |
wiki/linux/ubuntu-install-nginx-php-mysql.1570268009.txt.gz · 最后更改: 2023/01/03 15:24 (外部编辑)