云服务:Ubuntu 18.04 64位 阿里云
sudo apt-get update
配置中文
sudo apt-get install -y language-pack-en-base
locale-gen en_US.UTF-8
sudo apt-get install software-properties-common
sudo LC_ALL=en_US.UTF-8 add-apt-repository ppa:ondrej/php
sudo apt-get update
按需配置
sudo apt-get -y install php7.1
sudo apt-get -y install php7.1-mysql
sudo apt-get install php7.1-fpm
apt-get install php7.1-curl php7.1-xml php7.1-mcrypt php7.1-json php7.1-gd php7.1-mbstring
sudo apt-get -y install nginx 配置完成并正确可以直接打开域名查看
sudo apt-get -y install mysql-server-5.8
报错
E: Unable to locate package mysql-server-5.8
E: Couldn't find any package by glob 'mysql-server-5.8'
E: Couldn't find any package by regex 'mysql-server-5.8'
使用sudo apt-get -y install mysql-server
配置nginx如下修改:
sudo vim /etc/php/7.1/fpm/php.ini // 将cgi.fix_pathinfo=1这一行去掉注释,将1改为0
sudo vim /etc/php/7.1/fpm/pool.d/www.conf // 配置这个 listen = /var/run/php7.1-fpm.sock
sudo service php7.1-fpm restart
sudo vim /etc/nginx/sites-available/default
listen 80 default_server;
listen [::]:80 default_server ipv6only=on;
root /var/www/laravel-ubuntu/public;
index index.php index.html index.htm;
# Make site accessible from http://localhost/
server_name localhost;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location ~ \.php$ {
try_files $uri /index.php =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/var/run/php7.1-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
如下报错:
Job for nginx.service failed because the control process exited with error code.
See "systemctl status nginx.service" and "journalctl -xe" for details.