一.升級(jí)當(dāng)前系統(tǒng)資源
sudo apt-get update && sudo apt-get upgrade
二.安裝Nginx環(huán)境
1.sudo apt-get install nginx
2.Nginx默認(rèn)配置文件地址(/etc/nginx/sites-available/default)
server {
listen 80;
listen [::]:80;
server_name ;
root?? /var/www/html;#網(wǎng)站根目錄
index? index.html index.php;
location / {
????try_files $uri $uri/ =404;
????}
}
3.service nginx ?restart重啟Nginx服務(wù)
三 锚扎、安裝PHP7
1.sudo apt-get install php7.0-cli php7.0-cgi php7.0-fpm
2.修改Nginx配置文件
server {
listen 80;
listen [::]:80;
server_name;
root?? /var/www/html;#網(wǎng)站根目錄
index? index.html index.php;
location / {
????????try_files $uri $uri/ =404;
????}
location ~ \.php$ {
????????include snippets/fastcgi-php.conf;
????????include fastcgi_params;
????????fastcgi_pass unix:/run/php/php7.0-fpm.sock;
????????fastcgi_param SCRIPT_FILENAME /var/www/html$fastcgi_script_name;
????}
}
3.啟動(dòng)配置生效
sudo systemctl restart php7.0-fpm nginx
四 吞瞪、安裝mysql數(shù)據(jù)庫(kù)
1.sudo apt-get install mysql-server php7.0-mysql
2.sudo systemctl restart php7.0-fpm ?重啟生效