M
M
MrBobo2015-07-15 12:54:12
Nginx
MrBobo, 2015-07-15 12:54:12

How to configure nginx so that all non-existent kjkfdgkj.site.com are reverted to site.com?

kjkfdgkj.site.com reverted to site.com
or led to 404
but static.site.com remained static.site.com

Answer the question

In order to leave comments, you need to log in

1 answer(s)
L
Lynn "Coffee Man", 2015-07-15
@CafeKiwii

# главный сайт
server {
  listen 80;
  server_name site.com;
  ...
}

# статика
server {
  listen 80;
  server_name static.site.com;
  ...
}

# всё остальное
server {
  listen 80 default_server;
  # редирект на site.com
  return 301 http://site.com;
  # или 404
  #return 404;
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question