Configure Nginx to receive any domain

Asked

Viewed 646 times

1

I have this configuration on Nginx that any domain that is pointed at on my server it accesses the folder with the domain name.

My question is how do I get my clients to point their domain to my server only in one folder.

Example: my website is www.meudominio.com, when it points to my site it accesses its friendly URL type www.meudominio.com/user, as if it were a virtual store service like the hostgator, thanks in advance for the help!

server {
    listen 80;
    server_name   ~^(www\.)?(?<domain>.+)$;
    root   /usr/share/nginx/html/$domain;
    port_in_redirect off;
    index index.html index.php;
    location / {
        charset utf-8;
        if (!-e $request_filename) {
        rewrite ^.*$ /index.php last;       
        }
    }   
    location /url/ {
        if (!-e $request_filename) {
        rewrite ^(.*)$ /url/index.php?url=$1 last;      
        }
    }   
    rewrite /wp-admin$ $scheme://$host$uri/ permanent;
    location ~* ^.+\.(ogg|ogv|svg|svgz|eot|otf|woff|mp4|ttf|rss|atom|jpg|jpeg|gif|png|ico|zip|tgz|gz|rar|bz2|doc|xls|exe|ppt|tar|mid|midi|wav|bmp|rtf)$ {
        access_log off; log_not_found off; expires max;
    }
    location ~ [^/]\.php(/|$)  {
        fastcgi_split_path_info ^(.+?\.php)(/.*)$;
        if (!-f $document_root$fastcgi_script_name) {
            return      444;
        }
        fastcgi_pass 127.0.0.1:9000;
        fastcgi_index  index.php;
        fastcgi_param  SCRIPT_FILENAME    $document_root$fastcgi_script_name;
        fastcgi_buffer_size 128k;
        fastcgi_buffers 256 16k;
        fastcgi_busy_buffers_size 256k;
        fastcgi_temp_file_write_size 256k;
        include fastcgi_params;
        fastcgi_param   SERVER_PORT 80;
    }
}
  • In what part did it not work? It seems right.

1 answer

-1

I believe they will have to make an alias (CNAME) in their domain DNS for their domain. Here is an example in Registro.br.

inserir a descrição da imagem aqui.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.