Vesta Control Panel - Forum

Community Forum

Skip to content

Advanced search
  • Quick links
    • Main site
    • Github repo
    • Google Search
  • FAQ
  • Login
  • Register
  • Board index Main Section Web Server
  • Search

How to block direct IP Access?

Questions regarding the Web Server
Apache + Nginx, Nginx + PHP5-FPM
Post Reply
  • Print view
Advanced search
2 posts • Page 1 of 1
dazdylz
Posts: 3
Joined: Mon Feb 29, 2016 7:01 pm

How to block direct IP Access?
  • Quote

Post by dazdylz » Wed Mar 02, 2016 10:14 am

Hi,

If I go to my IP address, I go to my first website. I don't want this.

How can they see a 403 error message?

This is what I have tried:

Code: Select all

server {
    listen 80;
    listen 443;
    return 403;
}


in
/etc/nginx/conf.d/default.conf

and

/etc/nginx/nginx.conf

I restarted nginx multiple times but if I go to my IP address it is not showing the 403 message. What am I doing wrong?
Top

kmore
Posts: 3
Joined: Mon Feb 29, 2016 12:38 pm

Re: How to block direct IP Access?
  • Quote

Post by kmore » Sun Mar 06, 2016 7:28 am

Try adding server_name directive before return :

server {
listen 80;
listen 443;
server_name IP_ADDRESS;
return 403;
}
Top


Post Reply
  • Print view

2 posts • Page 1 of 1

Return to “Web Server”



  • Board index
  • All times are UTC
  • Delete all board cookies
  • The team
Powered by phpBB® Forum Software © phpBB Limited
*Original Author: Brad Veryard
*Updated to 3.2 by MannixMD
 

 

Login  •  Register

I forgot my password