nginx上配置phpmyadmin

Nginx配置phpmyadmin流程以下:php

1、準備軟件和環境(這裏我以ubuntu16.04爲例)

1.安裝php7.1

sudo LC_ALL=C.UTF-8 add-apt-repository ppa:ondrej/php sudo apt-get update sudo apt-get install php-pear php7.1-cli php7.1-common php7.1-curl \ php7.1-dev php7.1-fpm php7.1-json php7.1-mbstring php7.1-mcrypt \ php7.1-mysql php7.1-opcache php7.1-zip php7.1-intl php7.1-gd php7.1-xml

(1)修改 PHP-FPM 監聽方式爲127.0.0.1:9000

sudo sed -i 's/listen = .*/listen = 127.0.0.1:9000/g' /etc/php/7.1/fpm/pool.d/www.conf

(2)重啓 PHP-FPM 服務進程

sudo service php7.1-fpm restart

2.安裝mysql

(1)配置mysql5.7源

# 可在 http://dev.mysql.com/downloads/repo/apt/ 頁面找到 mysql-apt-config 的最新版本。
wget http://dev.mysql.com/get/mysql-apt-config_0.8.7-1_all.deb
sudo dpkg -i mysql-apt-config_0.8.7-1_all.deb

這時會彈出讓你選擇,將:mysql

MySQL Server修改成: mysql-5.7
MySQL Tools & Connectors (Currently selected: Enabled)修改成Disabled。
MySQL Preview Packages修改過爲 Disabled。nginx

(2)安裝mysql服務端

sudo apt-get update sudo apt-get install mysql-server

3.下載最新版phpmyadmin,能夠到去下載:

wget https://files.phpmyadmin.net/phpMyAdmin/4.8.5/phpMyAdmin-4.8.5-all-languages.zip
unzip phpMyAdmin-4.8.5-all-languages.zip mv phpMyAdmin-4.8.5-all-languages.zip phpmyadmin

4.安裝nginx:

sudo add-apt-repository ppa:nginx/stable sudo apt-get update sudo apt-get install nginx

2、將phpmyadmin複製到/var/www目錄下

cp -r phpmyadmin /var/www

3、配置nginx(主要修改nginx.conf配置文件)

這段代碼放到http{}裏面sql

server { listen 8090; root /var/www/phpmyadmin; index index.php; location ~ \.php$ { include snippets/fastcgi-php.conf; fastcgi_pass unix:/run/php/php7.1-fpm.sock; }

4、重啓nginxjson

訪問:http://IP地址:8090/便可看到
效果圖以下:ubuntu

相關文章
相關標籤/搜索