Nginx + phpmyadmin 於 ubuntu 16.04 安裝
apt install phpmyadmin
sudo ln -s /usr/share/phpmyadmin/ /var/www/html/phpmyadmin
我有特別給它一個網站
後面那一段 allow IP 可以限制特定網域能使用
server {
listen 80 default_server;
listen [::]:80 default_server;
root /var/www/html;
index index.php index.html index.htm index.nginx-debian.html;
server_name my.site.com;
location / {
try_files $uri $uri/ =404;
}
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/run/php/php7.0-fpm.sock;
}
location ~ /\.ht {
deny all;
}
location /phpmyadmin/ { ## Use the request url, not the directory on the filesystem.
allow IP; ## Your specific IP
deny all;
}
}
這段即是只有特定的IP位址可以瀏覽這個目錄
location /phpmyadmin/ { ## Use the request url, not the directory on the filesystem.
allow IP; ## Your specific IP
deny all;
}
sudo ln -s /usr/share/phpmyadmin/ /var/www/html/phpmyadmin
我有特別給它一個網站
後面那一段 allow IP 可以限制特定網域能使用
server {
listen 80 default_server;
listen [::]:80 default_server;
root /var/www/html;
index index.php index.html index.htm index.nginx-debian.html;
server_name my.site.com;
location / {
try_files $uri $uri/ =404;
}
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/run/php/php7.0-fpm.sock;
}
location ~ /\.ht {
deny all;
}
location /phpmyadmin/ { ## Use the request url, not the directory on the filesystem.
allow IP; ## Your specific IP
deny all;
}
}
這段即是只有特定的IP位址可以瀏覽這個目錄
location /phpmyadmin/ { ## Use the request url, not the directory on the filesystem.
allow IP; ## Your specific IP
deny all;
}
留言