Expand my Community achievements bar.

SOLVED

How to change AEM hostname from localhost to <any other name>?

Avatar

Community Advisor

Hi,

I need to change the AEM hostname from localhost to any other name? 
How can I do so?

 

Thanks,

Himanshu

1 Accepted Solution

Avatar

Correct answer by
Administrator

Hi 

As correctly mentioned by Lee and Tuhin, 

If the aim of your use-case is to change the URL from “localhost” to something else, on a local system then    

    For Windows 10 and 8

    Press the Windows key.
    Type Notepad in the search field.
    In the search results, right-click Notepad and select Run as administrator.
    From Notepad, open the following file: c:\Windows\System32\Drivers\etc\hosts
    127.0.0.1   www.example.com
    Click File > Save to save your changes.
   

 For Windows 7 and Vista

    Click Start > All Programs > Accessories.
    Right-click Notepad and select Run as administrator.
    Click Continue on the Windows needs your permission UAC window.
    When Notepad opens, click File > Open.
    In the File name field, type C:\Windows\System32\Drivers\etc\hosts.
    Click Open.
    127.0.0.1   www.example.com
    Click File > Save to save your changes.

Linux

    Open a terminal window.
    Open the hosts file in a text editor (you can use any text editor) by typing the following line: sudo nano /etc/hosts

    Enter your domain user password.
    Make the necessary changes to the file.
    Press Control-x.
    When asked if you want to save your changes, answer y.

Mac

    Open Applications > Utilities > Terminal.
    Open the hosts file by typing the following line in the terminal window: sudo nano /private/etc/hosts

    Type your domain user password when prompted.
    Edit the hosts file.

    The file contains some comments (lines starting with the # symbol), and some default hostname mappings (for example, 127.0.0.1 – local host). Add your new mappings after the default mappings.

    Save the hosts file by pressing Control+x and answering y.
    Make your changes take effect by flushing the DNS cache with the following command: dscacheutil -flushcache

Reference Link:- https://support.rackspace.com/how-to/modify-your-hosts-file/

And , if your use-case it to deploy actually, then please refer to this documentation link:- https://docs.adobe.com/docs/en/aem/6-2/deploy/application-server-install.html

I hope this will help you.

Thanks and Regards

Kautuk Sahni



Kautuk Sahni

View solution in original post

4 Replies

Avatar

Level 8

If you're on Windows, you can modify your hosts file with these instructions [1] or OSX [2] to give you a pseudo domain.

If you're talking about for an actual domain, that's a whole different subject and it wouldn't be running on your local host.

[1] http://www.howtogeek.com/howto/27350/beginner-geek-how-to-edit-your-hosts-file/

[2] https://www.tekrevue.com/tip/edit-hosts-file-mac-os-x/

Avatar

Level 7

Considering you are on a Windows env, open the file c:\windows\system32\drivers\etc\hosts in a notepad. Add a entry 127.0.0.1       <any other name>, save it. PFA the screenshot.

try hitting  <any other name>:4502 (myaemsite:4502) and that should be it.

 

For mac OS do the same, only the hosts file is in /private/etc/hosts location for mac.

 

Thanks

Tuhin

Avatar

Correct answer by
Administrator

Hi 

As correctly mentioned by Lee and Tuhin, 

If the aim of your use-case is to change the URL from “localhost” to something else, on a local system then    

    For Windows 10 and 8

    Press the Windows key.
    Type Notepad in the search field.
    In the search results, right-click Notepad and select Run as administrator.
    From Notepad, open the following file: c:\Windows\System32\Drivers\etc\hosts
    127.0.0.1   www.example.com
    Click File > Save to save your changes.
   

 For Windows 7 and Vista

    Click Start > All Programs > Accessories.
    Right-click Notepad and select Run as administrator.
    Click Continue on the Windows needs your permission UAC window.
    When Notepad opens, click File > Open.
    In the File name field, type C:\Windows\System32\Drivers\etc\hosts.
    Click Open.
    127.0.0.1   www.example.com
    Click File > Save to save your changes.

Linux

    Open a terminal window.
    Open the hosts file in a text editor (you can use any text editor) by typing the following line: sudo nano /etc/hosts

    Enter your domain user password.
    Make the necessary changes to the file.
    Press Control-x.
    When asked if you want to save your changes, answer y.

Mac

    Open Applications > Utilities > Terminal.
    Open the hosts file by typing the following line in the terminal window: sudo nano /private/etc/hosts

    Type your domain user password when prompted.
    Edit the hosts file.

    The file contains some comments (lines starting with the # symbol), and some default hostname mappings (for example, 127.0.0.1 – local host). Add your new mappings after the default mappings.

    Save the hosts file by pressing Control+x and answering y.
    Make your changes take effect by flushing the DNS cache with the following command: dscacheutil -flushcache

Reference Link:- https://support.rackspace.com/how-to/modify-your-hosts-file/

And , if your use-case it to deploy actually, then please refer to this documentation link:- https://docs.adobe.com/docs/en/aem/6-2/deploy/application-server-install.html

I hope this will help you.

Thanks and Regards

Kautuk Sahni



Kautuk Sahni

Avatar

Community Advisor

Hey Thanks. It's working fine. 

But, now, I've 1 more question. Let suppose, we've 2 aem publish instance running on my system and I need to configure Dispatcher with these 2 publish instances. In that case, inside dispatcher.any file renders section, I'll add up configuration for both as /rend01, /rend02.

But, when I'll try to access it with the webserver(as webserver hostname is localhost) without port number, which Instance will it connect to (let say, open any geometrixx site page)?

Thanks,

Himanshu