导语
上次写了centos安装搭建lnmp环境,今天写一下ubuntu18.04的
因为mysql的安装是一样的,所以这篇就没再写msyql的安装,可以查看上一篇的最后 传送门-开
一、nginx 安装
apt update
apt upgrade
apt install nginx
service nginx start
systemctl enable nginx
二、php71 安装
apt install software-properties-common
add-apt-repository ppa:ondrej/php
apt update
apt install php7.1-fpm php7.1-mcrypt php7.1-cli php7.1-xml php7.1-mysql php7.1-gd php7.1-imagick php7.1-recode php7.1-tidy php7.1-xmlrpc php7.1-mbstring php7.1-curl
三、配置 nginx 、php
cp /etc/nginx/sites-available/default /etc/nginx/sites-available/xxx.com
xxx.com 改成
server {
listen 80;
listen [::]:80;
# SSL configuration
#
# listen 443 ssl default_server;
# listen [::]:443 ssl default_server;
#
# Note: You should disable gzip for SSL traffic.
# See: https://bugs.debian.org/773332
#
# Read up on ssl_ciphers to ensure a secure configuration.
# See: https://bugs.debian.org/765782
#
# Self signed certs generated by the ssl-cert package
# Don't use them in a production server!
#
# include snippets/snakeoil.conf;
root /alidata/mamaqunaer/activity_mutuki;
# Add index.php to the list if you are using PHP
index index.html index.htm index.php;
server_name xxx.com;
location / {
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
# try_files $uri $uri/ =404;
if (!-e $request_filename) {
rewrite ^(.*)$ /index.php?s=$1;
}
}
# 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;
}
# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
location ~ /\.ht {
deny all;
}
}
ln -s /etc/nginx/sites-available/xxx.com /etc/nginx/sites-enabled/
service nginx restart
修改 /etc/php/7.1/fpm/pool.d/www.conf 文件
把 listen 改成 listen = 127.0.0.1:9000
重启php-fpm命令: service php7.1-fpm restart
