Nginx服务器上安装并配置PHPMyAdmin的教程
这篇文章主要介绍了Nginx服务器上安装并配置PHPMyAdmin的教程,附带一条PHPMyAdmin加载慢的解决方法:)需要的朋友可以参考下
一、 准备工作:
1. 如果mysql的root账号为空,需要设置root密码
CentOS下默认安装的mysql服务器,里面的root账号默认密码为空,首先为root设置一个密码
#mysqladmin -u root password yourpassword
*注: 虽然通过一些特殊配置,可以使phpmyadmin允许空密码登录,但是不推荐这样做,尤其是公网的服务器。
2. 设置php.ini正确配置session.save_path
1). 首先检查php.ini配置文件
#grep session.save_path /etc/php.ini
如果不存在以下设置,增加该配置。如果被注释了话,去掉注释
session.save_path = “/var/lib/php/session”
2). 查看该目录是否存在:
#ls /var/lib/php/session
如果不存在,则手工创建
#mkdir /var/lib/php/session
# 修改目录属主为nginx
chown nginx:nginx session/ -R
# 重启启动php-fpm
service php-fpm restart
二、安装配置phpmyadmin
1. 下载并解压到phpmyadmin
官方下载页面:
(中文用户应该选择下载all-languages版本)
下载完成后,解压:
unzip phpMyAdmin-4.1.12-all-languages.zip
移动到相应的目录位置,并改成容易访问的名称:
mv phpMyAdmin-4.1.12-all-languages /www/phpmyadmin
2. 配置phpmyadmin
复制一份配置文件:
#cd /www/phpmyadmin #cp config.sample.inc.php config.inc.php
配置config.inc.php
#vi config.inc.php
设置一个内部使用的秘钥(和内部加密有关,,与页面登录没有直接关系)
$cfg['blowfish_secret'] = ‘';
三、配置Nignx下的站点
vi /etc/nginx/conf.d/phpmyadmin.conf
server { listen 8081; server_name localhost; access_log /var/log/nginx/phpmyadmin-access.log main; location / { root /www/phpmyadmin; index index.php; } location ~ \.php$ { root /www/phpmyadmin; fastcgi_pass unix:/var/run/php-fpm/php-fpm.sock; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; } location ~ /\.ht { deny all; } }
重启nginx:
#service nginx restart
完成安装,访问:8081/,测试phpmyadmin。
四、phpmyadmin加载缓慢的解决方法
phpmyadmin4.0系列通通加载缓慢的最终原因是最近phpmyadmin的官网经常打不开,而phpmyadmin页面会自动检查官网上的程序 版本更新,所以当你进入phpmyadmin管理页面点击数据库的时候phpmyadmin一直在尝试连接官网从而把整个打开过程拖得很慢。
最终的解决办法是不让phpmyadmin检查更新,找到phpmyadmin目录下version_check.php文件,具体修改如下:
if (isset($_SESSION['cache']['version_check']) && time()
上面代码是通过注释掉else{......}中间这段来取消phpmyadmin连接官网version.json来检查更新
修改完后phpmyadmin马上又回到秒开了。

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics



To allow the Tomcat server to access the external network, you need to: modify the Tomcat configuration file to allow external connections. Add a firewall rule to allow access to the Tomcat server port. Create a DNS record pointing the domain name to the Tomcat server public IP. Optional: Use a reverse proxy to improve security and performance. Optional: Set up HTTPS for increased security.

When Navicat cannot connect, you can try the following solutions in order: Check whether the connection information is correct, such as database name, host name, port number, user name and password. Make sure the database is up and running. Check the firewall rules to confirm that Navicat and related services are not blocked. Try using the ping command to test your network connection. Update Navicat client software to the latest version. Check the server logs for error messages related to failed connections. Try connecting using other database tools to troubleshoot Navicat-specific issues.

To solve the "Welcome to nginx!" error, you need to check the virtual host configuration, enable the virtual host, reload Nginx, if the virtual host configuration file cannot be found, create a default page and reload Nginx, then the error message will disappear and the website will be normal show.

Answer: You can view and recover a forgotten Navicat root password by modifying the MySQL configuration file. Stop the Navicat MySQL service. Modify the MySQL configuration file, remove the "#" symbol before the password line and enter the root password. Save and restart the MySQL service.

Server deployment steps for a Node.js project: Prepare the deployment environment: obtain server access, install Node.js, set up a Git repository. Build the application: Use npm run build to generate deployable code and dependencies. Upload code to the server: via Git or File Transfer Protocol. Install dependencies: SSH into the server and use npm install to install application dependencies. Start the application: Use a command such as node index.js to start the application, or use a process manager such as pm2. Configure a reverse proxy (optional): Use a reverse proxy such as Nginx or Apache to route traffic to your application

Converting an HTML file to a URL requires a web server, which involves the following steps: Obtain a web server. Set up a web server. Upload HTML file. Create a domain name. Route the request.

Yes, Node.js can be accessed from the outside. You can use the following methods: Use Cloud Functions to deploy the function and make it publicly accessible. Use the Express framework to create routes and define endpoints. Use Nginx to reverse proxy requests to Node.js applications. Use Docker containers to run Node.js applications and expose them through port mapping.

To successfully deploy and maintain a PHP website, you need to perform the following steps: Select a web server (such as Apache or Nginx) Install PHP Create a database and connect PHP Upload code to the server Set up domain name and DNS Monitoring website maintenance steps include updating PHP and web servers, and backing up the website , monitor error logs and update content.
