Ubuntu下快速部署安装 Nginx + PHP + MySQL 笔记
程序员文章站
2022-05-28 23:18:29
...
先更新软件库
sudo apt-get update
安装 MySQL
sudo apt-get install mysql-server
安装Nginx
sudo apt-get install nginx
安装 php-fpm
sudo apt-get install php5-fpm
配置 nginx 整合 php
server { listen 80 default_server; listen [::]:80 default_server ipv6only=on; root /path/to/laravel/public; index index.php index.html index.htm; server_name laravel.app; location / { try_files $uri $uri/ /index.php; } error_page 500 502 503 504 /50x.html; location = /50x.html { root /usr/share/nginx/html; } location ~ \.php$ { # With php5-fpm: try_files $uri =404; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; include fastcgi_params; } # deny access to .htaccess files, if Apache's document root # concurs with nginx's one # location ~ /\.ht { deny all; }}
然后检查配置文件正确性
sudo service nginx configtest
重新加载配置文件
sudo service nginx reload
安装 php 常用扩展
sudo apt-get install php5-mysql php5-curl php5-gd php5-intl php-pear php5-imagick php5-imap php5-mcrypt php5-memcache php5-ming php5-ps php5-pspell php5-recode php5-snmp php5-sqlite php5-tidy php5-xmlrpc php5-xsl php5-xcache
重启 php-fpm
sudo service php5-fpm restart
推荐阅读
-
linux下apache、mysql、php安装配置详细笔记
-
Gentoo 下安装与配置Nginx+ MySQL + PHP (fastcgi) 环境步骤分享
-
Ubuntu+Nginx+Mysql+Php+Zend+eaccelerator安装配置文字版
-
Centos7下编译安装配置Nginx+PHP+MySql环境
-
基于ubuntu下nginx+php+mysql安装配置的具体操作步骤
-
linux下安装nginx+php+mysql环境 详细教程
-
ubuntu下配置nginx+php+mysql详解
-
Ubuntu 18.04.1 下快速搭建 LNMP环境(PHP7.2.5+MySql5.7+Nginx1.14.0)
-
Ubuntu16.04用源安装Nginx+PHP5.6+MySQL5.6
-
阿里云CentOS7下部署Nginx,MySQL,PHP7环境