Deutsch
Servers, HTTP & caching

Server configuration

Also known as: Nginx/Apache

Server configuration, in an SEO context, means the settings of a web server such as nginx or Apache that decide how requests are answered. These settings determine redirects, status codes, HTTP headers and which URLs are served at all.

Why does server configuration matter for SEO?

Search engines see the result of the configuration: the status code, the headers and the redirect target. A wrong rule can send a whole site to a 404 or 500 page, or create redirect chains that go unnoticed in the CMS.

Nginx reads its settings from a main file named nginx.conf, commonly located in /etc/nginx/. Inside it, server blocks define the domain and port, and location blocks define how matching URLs are handled. After an edit, nginx -s reload applies the new configuration without downtime, and a configuration with a syntax error is not applied.

Apache can be configured centrally or through .htaccess files in single directories. The Apache project recommends the central configuration where possible, because .htaccess files are read on every request. Nginx has no equivalent of .htaccess.

Example

A permanent redirect from HTTP to HTTPS in nginx:

nginx
server {
    listen 80;
    server_name example.com www.example.com;
    return 301 https://example.com$request_uri;
}

For single URLs, the rewrite directive with the permanent flag returns a 301:

nginx
rewrite ^/old-page$ /new-page permanent;

Common mistakes

  • Redirect rules that conflict, producing loops or chains.
  • Using redirect (302) where a permanent move needs permanent (301).
  • Setting headers such as X-Robots-Tag on the wrong location, so they miss part of the site.
  • Editing the live configuration without testing it first.

Sources

  1. Beginner's Guide – nginx.orgnginx.org
  2. Module ngx_http_rewrite_module – nginx.orgnginx.org
  3. Apache HTTP Server Tutorial: .htaccess fileshttpd.apache.org
  4. Robots meta tag and X-Robots-Tag – Google Search Centraldevelopers.google.com

Last updated: