Nginx and Apache How to set IP address access restrictions

Source: Internet
Author: User

One, Nginx prohibit IP address access

1. Add this in the Nginx configuration file:



2. Restart Nginx Service



Second, Apache prohibit IP address access

1. Change the vhosts.conf file:

Namevirtualhost 192.168.1.191<virtualhost 192.168.1.191:99> #DocumentRoot "/usr/local/kk-mail/data/www" Serve Rname 192.168.1.191 <location/> Order allow,deny Deny from all </Location> errorlog "L Ogs/mail_error_log_ip "Customlog" logs/mail_access_log_ip "common</virtualhost> <VirtualHost 192.168.1.191:99> documentroot "/usr/local/kk-mail/data/www" ServerName mail.domain.com errorlog "Logs/mail_er Ror_log "Customlog" Logs/mail_access_log "common</virtualhost>


2. Restart Apache Service

Nginx and Apache How to set IP address access restrictions

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.