Home>Article>PHP Framework> Quick installation steps for Nginx + PHP + MySQL under Ubuntu

Quick installation steps for Nginx + PHP + MySQL under Ubuntu

不言
不言 Original
2018-07-28 17:49:59 2623browse

How to deploy and install Nginx PHP MySQL under Ubuntu? In the previous article, we introduced the rapid deployment and installation of Apache PHP MySQL phpMyAdmin underUbuntu. Next, we will introduce the rapid deployment and installation of Nginx PHP MySQL under Ubuntu. Let’s take a look at the specific steps. Bar.

Update the software library first

sudo apt-get update

Install MySQL

sudo apt-get install mysql-server

Install Nginx

sudo apt-get install nginx

Install php-fpm

sudo apt-get install php5-fpm

Configuration nginx integrates php

sudo cp /etc/nginx/sites-available/default /etc/nginx/sites-available/app sudo vi /etc/nginx/sites-available/app

Edit the configuration file /etc/nginx/sites-available/app and the content is as follows:

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$query_string; } 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; } }

Next create the corresponding soft link in the /etc/nginx/sites-enabled directory :

sudo ln -s /etc/nginx/sites-available/app /etc/nginx/sites-enabled/app

Then check the correctness of the configuration file

sudo service nginx configtest

Reload the configuration file

sudo service nginx reload

Install php common extensions

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

Restart php-fpm

sudo service php5-fpm restart

Recommended related articles:

Quick deployment and installation of Apache PHP MySQL phpMyAdmin under Ubuntu

Lamp environment configuration for CentOS 6.3 Alibaba LAMP environment configuration under cloud server

Laravel environment setup: How to deploy laravel to Alibaba Cloud or Tencent Cloud Steps

Related course recommendations:

The latest five recommended Laravel video tutorials in 2017

The above is the detailed content of Quick installation steps for Nginx + PHP + MySQL under Ubuntu. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn