记录 Ubuntu18.04 lnmp nginx1.14 PHP7.2 MySQL5.7 安装 配置

1.apt更新

apt update

2.安装nginx1.14
系统默认安装1.14 ,具体版本和系统相关

apt install -y nginx

3.安装mysql
系统默认安装5.7.24,具体版本和系统相关

apt install -y mysql-server mysql-client

4.安装php

apt install -y php7.2 php7.2-fpm php7.2-mysql

5.配置站点
进入站点目录

cd /etc/nginx/sites_enabled
vim www.conf

5.1端口

 listen 80 default_server;
 listen [::]:80 default_server;

5.2项目目录

root /var/www/html;

5.3域名

server_name www.domain.com;

5.4url重写

location / {
     try_files $uri $uri/ /index.php?$query_string;
}

5.5解析php

location ~ \.php$ {
     include snippets/fastcgi-php.conf;
     fastcgi_pass unix:/run/php/php7.2-fpm.sock;
     fastcgi_pass 127.0.0.1:9000;
}

QQ交流群 602748730

你可能感兴趣的:(记录 Ubuntu18.04 lnmp nginx1.14 PHP7.2 MySQL5.7 安装 配置)