Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WordPress] Bitnami nginx - how to configure access to wp-admin for whitelisted IP addresses #1508

Closed
Torwald45 opened this issue Apr 28, 2024 · 5 comments
Assignees
Labels
how-to How to issues reported by users solved stale 15 days without activity triage Triage is needed wordpress-nginx

Comments

@Torwald45
Copy link

Describe your issue as much as you can

I tried adding such a block (instead of xxx.xxx.xxx.xxx I provided my own IP address):

location ~ ^/(wp-admin|wp-login\.php) {
                allow xxx.xxx.xxx.xxx;
                deny all;
  }

sequentially to files:

/opt/bitnami/nginx/conf/server_blocks/wordpress-server-block.conf

/opt/bitnami/nginx/conf/nginx.conf

This causes a server error every time and you can't access the site.

Where to add this block to make it work?

@Torwald45 Torwald45 added the how-to How to issues reported by users label Apr 28, 2024
@github-actions github-actions bot added the triage Triage is needed label Apr 28, 2024
@Torwald45
Copy link
Author

Ok, I figured out how to do it differently - using Basic Auth. Steps:

  1. Edit file:
    sudo nano /opt/bitnami/nginx/conf/server_blocks/wordpress-https-server-block.conf

  2. In block Server { add:

# BASIC-Authentication
location ~* /wp-login.php|/wp-admin/.*\.php$ {
     auth_basic "basic authentication";
     auth_basic_user_file "/bitnami/wordpress/.htpasswd";
     fastcgi_pass unix:/opt/bitnami/php/var/run/www.sock;
     fastcgi_index index.php;
     include fastcgi_params;
     fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
     fastcgi_param PATH_INFO $fastcgi_path_info;
     fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;
}
# end BASIC-Authentication
  1. Restart server:
    sudo /opt/bitnami/ctlscript.sh restart

  2. Install:
    sudo apt-get install apache2-utils

  3. Create:
    htpasswd -c /bitnami/wordpress/.htpasswd YOUR-USER
    This command will create access for YOUR-USER, you will need to provide a password.

  4. Test your-application/wp-admin

@jotamartos
Copy link
Collaborator

Thanks for posting the information here, it'll be really helpful for others in the same situation.

Have a good week!

Copy link

This Issue has been automatically marked as "stale" because it has not had recent activity (for 15 days). It will be closed if no further activity occurs. Thanks for the feedback.

@github-actions github-actions bot added the stale 15 days without activity label May 22, 2024
Copy link

Due to the lack of activity in the last 5 days since it was marked as "stale", we proceed to close this Issue. Do not hesitate to reopen it later if necessary.

@bitnami-bot bitnami-bot closed this as not planned Won't fix, can't repro, duplicate, stale May 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
how-to How to issues reported by users solved stale 15 days without activity triage Triage is needed wordpress-nginx
Projects
None yet
Development

No branches or pull requests

4 participants
@jotamartos @bitnami-bot @Torwald45 and others