Quantcast
Channel: Nginx Forum - How to...
Viewing all articles
Browse latest Browse all 4759

Re: Problem with subdomain wildcard and localhost

$
0
0
Hello

I believe I have managed to partially solve this(within my own knowledge of things)

Firstly, Within your hosts file(independant of nginx) you must setup some subdomains, For windows it will originally look something like this

Before
127.0.0.1 localhost
After
127.0.0.1 localhost test.localhost example.localhost

Now in your nginx.conf file, Setup your server block like this.

server {
listen 80;
server_name ~(?<subdomain>.*).localhost;

You will now be able to access either localhost,test.localhost, or example.localhost, if you need the subdomain name in the url, you can access it via $subdomain.

Viewing all articles
Browse latest Browse all 4759

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>