环境:Debian 9.4,nginx 1.10.3,php7.0.27, MariaDB 10.1.26
过程:
1. apt update # 更新软件源
2. apt upgrade # 更新软件版本
3. apt autoremove # 自动删除一些“遗留”的不必要软件
4. apt install nginx # 安装 nginx
5. apt install php-fpm php-gd php-mysql php-mbstring php-curl php-xml # 安装 php 及相关组件
6. 编辑默认的nginx站点配置文件/etc/nginx/sites-enabled/default,添加 index.php 类型的默认首页文件,注释掉ipv6地址的监听及启用php
# Add index.php to the list if you are using PHP
index index.php index.html index.htm index.nginx-debian.html;
server_name _;
location / {
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
try_files $uri $uri/ =404;
}
# pass PHP scripts to FastCGI server
#
location ~ \.php$ {
include snippets/fastcgi-php.conf;
#
# # With php-fpm (or other unix sockets):
fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;
# # With php-cgi (or other tcp sockets):
# fastcgi_pass 127.0.0.1:9000;
}
7. systemctl restart nginx # 重启 nginx 服务,以让更改生效
8. apt install mariadb-server # 安装 MariaDB (mysql)数据库服务端
9. 通过 mysql 命令行,创建一个新的mysql用户
CREATE USER 'idbadm'@'localhost' IDENTIFIED BY 'meizi36829';
GRANT ALL PRIVILEGES ON *.* TO 'idbadm'@'localhost' WITH GRANT OPTION;
FLUSH PRIVILEGES;
10. 上传或下载一个phpmyadmin,用新建的mysql用户名和密码登录,测试正常
版权声明:本文内容由阿里云实名注册用户自发贡献,版权归原作者所有,阿里云开发者社区不拥有其著作权,亦不承担相应法律责任。具体规则请查看《阿里云开发者社区用户服务协议》和《阿里云开发者社区知识产权保护指引》。如果您发现本社区中有涉嫌抄袭的内容,填写侵权投诉表单进行举报,一经查实,本社区将立刻删除涉嫌侵权内容。