I have the following virtual host configuration for nginx in a virtual host:
server {
listen 80 default_server;
listen [::]:80 default_server;
server_name angularindepth.com
rewrite ^/(.*)$ https://blog.angularindepth.com/$1 redirect;
}
But when I run nginx it gives me the following errors:
- [warn] 5007#5007: server name "^/(.*)$" has suspicious symbols in ...
- [warn] 5007#5007: server name "https://blog.angularindepth.com/$1" has suspicious symbols in ...
- [emerg] 5007#5007: invalid server name or wildcard "^/(.*)$" on 0.0.0.0:80
I've googled and all questions seem to be around server_name
directive, whereas in my case it contains a proper name. The problem seems to be with rewrite
directive. Am I right? What's the problem?
A missing semi-colon here: