Change server name
I'm using nginx as my local server. I've been able to edit the configuration file for the site aliases to adjust the root of my sites, but I was wondering if there was a way to change the server name?
The folder name of my site is really long and I just want to make a shorter .dev url name. I've tried changing the server_name setting in the generated .conf (with auto removed) and adding a new .conf file with the shorter name and the correct root, but neither seem to work.
Do I just have to edit my machines host file in order to do this or can it be done with the nginx configurations?
@dradickLRE : Yes, you are doing right. Just 1 more step:
Add(not edit) your hosts file to the name you changed in nginx.
Thank you @leokhoa !
After doing adding it in both places, my shorter .dev url is working. I decided to play it safe and create a new .conf file while keeping the generated one. Here's how I set it up in case anyone else want's to follow them.
Step 1: Create a copy of the generated .conf file
Step 2: Change file name to my new .dev url
Step 3: Save new .dev url as the server_name in .conf file
Step 4: Add new .dev url in the in the hosts file (located at C:\Windows\System32\drivers\etc\hosts)
Step 5: Reload the nginx server