
나는 이 사이트의 지시를 따랐다.PHPMyAdmin 설치. 하지만 이 구성은 Apache용이며 저는 Nginx를 사용하고 있습니다. PHPMyadmin에 액세스하기 위해 허용되는 IP 주소를 제한하는 방법에 대한 온라인 자습서를 찾을 수 없습니다.
누군가 사이트를 추천하거나 이 작업을 수행하는 방법을 알려줄 수 있나요?
편집하다
현재 내 Nginx 구성은 다음과 같습니다.
server {
listen 80;
root /usr/share/nginx/html/cl2g/public/;
index index.php index.html index.htm;
server_name schedulium.ca;
# AnuglarJS UI Front /index.html
location / {
rewrite ^/(.*)/$ /$1 redirect;
if (!-e $request_filename) {
rewrite ^(.*)$ /index.html
break;
}
}
# PHPMyAdmin
location /phpmyadmin/ {
allow my-ip-address;
deny all;
rewrite ^/(.*)/$ /$1 redirect;
if (!-e $request_filename) {
rewrite ^(.*)$ /phpmyadmin/index.php;
}
}
# Laravel Back-end /api/index.php
location /api/ {
# try_files $uri $uri/ /index.php$is_args$args;
rewrite ^/(.*)/$ /$1 redirect;
if (!-e $request_filename) {
rewrite ^(.*)$ /api/index.php;
}
}
error_page 404 /404.html;
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
# pass the PHP scripts to FastCGI server listening on the php-fpm socket
# stfu
location ~ \.php$ {
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
fastcgi_split_path_info ^(.+\.php)(.*)$;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
답변1
Nginx에서는 htaccess를 통하지 않고 사이트 파일에 인수를 설정합니다.
/etc/nginx/sites-enabled/에서 해당 사이트 파일을 편집합니다.
당신의 위치가 다음과 같다면.
location /phpmyadmin {
....
}
다음을 추가하세요
allow 192.168.0.2/32;
deny all;
이렇게 하면 IP 192.168.0.2 호스트에만 액세스가 허용됩니다.
그런 다음 Nginx를 다시 시작하거나 다시 로드하세요.
답변2
링크를 추가한 튜토리얼을 따른 경우 IP 제한을 위해 .htaccess를 사용하고 있는 것입니다. Nginx에서는 nginx.conf를 사용할 수 있습니다.
server {
listen 80;
server_name name;
location / {
root /phpmyadmin;
passenger_enabled on;
allow your-public-ip;
deny all;
}
}
물론 IP 주소와 작동하도록 이를 변경해야 합니다.
기본적으로 PHPMyAdmin은 /usr/share/phpmyadmin
Ubuntu에 설치됩니다. 자신의 IP만 허용하는 옵션 이 phpMyAdmin.conf
있어야 합니다.
따라서 Nginx 또는 PHPMyAdmin을 통해 수행할 수 있습니다.