How to change the hostname "localhost" in Windows OS? - servlets

I am trying to change the hostname from "localhost" to "systemhost" (user-defined names).
I was actually running a servlet program where I suddenly got a question, if it is possible to change the hostname from localhost (default) to systemhost (user-defined)
What I have done so far:
Searched on the google but I get irrelevant answers.
Changed the server.xml file content from localhost to systemhost as I was running servlet program so I thought that this change can work along.
Navigated to C:\Windows\System32\drivers\etc and changed the hosts file. Replaced the word localhost to systemhost.
After doing all these no success. I wonder, if it is really possible to change?
Any help or suggestions?
Thanks!

uncomment that line by removing #.
it should be:
127.0.0.1 systemhost
::1 systemhost

Related

Ubuntu + nginx - trying to install GeoIP module

I'm using vagrant (VVV actually) to run local wordpress installs. I want to test different behaviors for different GEO's on my local machine instead of upload it every time to the server which is annoying.
So, I've tried to install the GeoIP nginx module to the local machine with the following guide https://piwik.org/faq/how-to/faq_166/ (and a bit more google but it doesn't matter at the moment).
When I'm using ./configure the following is exists:
checking for GeoIP library ... found
checking for GeoIP IPv6 support ... found
I've also set the .dat files in my conf file, and set the $_SERVER (fastcgi_param) parameters - so they displayed when I'm printing the $_SERVER var.
But those GeoIP vars are empty. I'm not sure about the reason, but 2 things is bothering me. First, when I'm write nginx -V in the terminal the argument --with-http_geoip_module is missing. Second, could it actually works if the REMOTE_ADDR (IP) is not my real IP? (192.168.1.50 for example).
nginx is a bit strange for me, so sorry if something isn't exact..
--
Operating system - macOS, nginx version - 1.3.15, running with VVV (vagrant box)
If there is a reverse proxy in front of your nginx, use geoip_proxy to set IPs whose X-Forwarded-For-Header can be trusted.
You can also use that without actually having a reverse proxy when you're developing. Add your local IP to the geoip_proxy-list and set the X-Forwarded-For-Header to your public IP in your browser (use a plugin like Modify Headers).

When updating a salt-minion the grains.host changes to localhost, breaking states

Scenario:
salt-minion original version: salt-minion 2015.8.8.2 (Beryllium)
salt-minion updated version: salt-minion 2016.11.2 (Carbon)
running a state which uses grains.host breaks
Checks:
salt 'minion' grains.item host originally returned the hostname configured in /etc/hostname (eg: minion)
After the update, it returns localhost
I tried restarting the minion (as I had to change the master url anyway), also tried the undocumented sanitized=True, which only hides it away.
Any help is appreciated, couldn't find anything on the site.
I found recently that sometimes it does matter what are your settings in /etc/hosts.
I had a set of hosts with FQDN like host01.company.com. And despite the same settings, one of them was having the same issues like you have. I went to /etc/hosts and removed record like
127.0.0.1 host01 host01.company.com
And after this and a minion restart, everything was fine immediately.
Looks like there is some kind of reverse-lookup happening to set some grains.
Hope this helps.

Xdebug with PHPStorm and a Docker container

Setup: Windows 10; Docker running with Boot2Docker on Hyper-V; PHPStorm 9
Webserver on the VM is Nginx. I've configured the xdebug.ini for php5-fpm as:
zend_extension=xdebug.so
xdebug.remote_enable=on
xdebug.remote_port=9000
xdebug.remote_connect_back=On
xdebug.remote_handler=dbgp
xdebug.profiler_enable=0
If I set a breakpoint and reload the page I get an incoming connection from Xdebug in PHPStorm:
I wonder that there is only one file shown and not the entire project which is much bigger. If I accept the connection I can debug the very first line but it is not stopping on my breakpoint and creates a server entry which looks like:
What is very strange that host is empty.
I already added the server with the correct mapping but it got ignored.
So how to get Xdebug to stop on breakpoints?
What is very strange that host is empty.
PhpStorm requires this field to be filled as it uses this to recognize what server entry (and therefore path mappings) to use -- IDE supports debugging the same code base running on different domains / remote servers.
In this particular case the servername field / parameter of your nginx configuration is empty. You can fix this by providing some value in nginx config file.

Alfresco webdav behind apache under jkmount

I'm trying to configure the access to an alfresco webdav directory.
Alfreso is in local ip 192.168.1.25. If I mount (with mount.davfs http:// 192.168.1.25 :8080) , it works ok.
If I configure jkmount in the apache server (in another local ip, 192.168.1.111), when I mount it (with mount.davfs http:// public /alfresco), it doesn't work. The mount error is:
mount.davfs: connection timed out two times;
trying one last time
mount.davfs: server temporarily unreachable;
mounting anyway
However, if I mount the URL with firefox, chrome, or Windows net share, it works ok.
I've tried different jkmount options, rewrites, etc., and with firefox and others it works ok, but it fails using mount (and I must use mount or any other command line tool).
Cadaver also fails.
Regards,
Thanks Heiko,
I've set up the virtual host with (Alfresco Server is in another server):
ProxyPass /alfresco ajp://192.168.1.25:8009/alfresco
ProxyPassReverse /alfresco ajp://192.168.1.25:8009/alfresco
<Location /alfresco/webdav/ >
<Limit OPTIONS PROPFIND GET REPORT MKACTIVITY PROPPATCH PUT CHECKOUT MKCOL MOVE COPY DELETE LOCK UNLOCK MERGE>
Order Deny,Allow
Allow from all
Satisfy Any
</Limit>
</Location>
And the problem persists: I mount it with firefox (and chrome, etc.) ok, but it fails with mount.davfs or cadaver. It doesn't work with curl too.
In alfresco-global.properties, this lines are commented:
# URL Generation Parameters (The ${localname} token is replaced by the local server name)
#-------------
#alfresco.context=alfresco
#alfresco.host=${localname}
#alfresco.port=8080
#alfresco.protocol=http
#
#share.context=share
#share.host=${localname}
#share.port=8080
#share.protocol=http
Are they necessary?
Is there any other apache directive for this?
I also tried to offer the directory via apache with:
ProxyPassMatch ^/alfresco/(.*)$ "http://192.168.1.25:8080/alfresco/$1"
ProxyPassReverse /alfresco/ "http://192.168.1.25:8080/alfresco/"
and
JkMount /alfresco/* alfresco configuring jk workers.properties with:
worker.list=alfresco
worker.alfresco.type=ajp13
worker.alfresco.host= 192.168.1. 25
worker.alfresco.port=8009
worker.alfresco.lbfactor=1
worker.alfresco.socket_keepalive=1
worker.alfresco.socket_timeout=300
And the results are the same: It works in navigators but not in linux console.
I've set apache logs in debug mode for this virtual hosts, and when I mount it with firefox, it writes the right info (ajp conections, etc) but when I try to mount from linux terminal, the logs are empty. This is like the conection doesn't work, but only from console...
Thanks for your help, I keep looking for solutions...
Did you set up virtual host like described here?
Also you may need to set ProxyPreserveHost Directive or something similar depending on your apache mod (mod_http_ajp or mod_jk)

Flex profiler gives "Socket timeout " error. Why for?

When trying to run the Flex Builder 3 profiler on any I don't get the profiler dialog window and then after a few seconds I get "Socket timeout" in the console window. Any ideas why it can't connect?
I've got the latest debug version of Flash player and have tried shutting off my firewall.
I'm running it on XP from the local drive, ie. not through localhost.
Thanks,
Alex
It looks like the browser (Firefox in my case) has to be shutdown before the profiler is started. Step 1. in the livedocs even says this -- wish I had read it earlier. :)
http://livedocs.adobe.com/flex/3/html/help.html?content=profiler_3.html
Make sure that your firewall does not block port 9999, you can customize the port number too: Open Preferences->Flex->Profiler->Connections.
Check /etc/hosts (C:\Windows\System32\drivers\etc\hosts), and see if it contains a line:
127.0.0.1 localhost
In my case, it was somehow changed to ::1 localhost, and that's why it stopped working.
Thanks to Ziv for the (poorly formatted) answer.
While I try to run my Flex Profiler I got this error message:
In the flash application I got the following exception:
Error #2044: Unhandled securityError:. text=Error #2048: Security sandbox violation:
file:///C|%2Fwork%2Flabsense%2Fbranches%2Frel%5F1%5F2%5F5%5FEA%2Fsources%2Fui%2F.metadata%2F.plugins%2Fcom.adobe.flash.profiler%2FProfilerAgent.swf?host=localhost&port=9999
cannot load data from localhost:9999.
at ProfilerAgent()[C:\SVN\branches\3.2.0\modules\profiler3\as\ProfilerAgent.as:127]
And in the flex Profiler console (at the eclipse) I got : Socket timeout.
I am run on windows vista,
Flex builder: 3.2
Flash debugger: 10,0,22,87
Things that I have done to resolve this issue:
Switch the connection port of the profiler to 9998 (and back)
Remove and reinstall the flash debugger player.
Install flex builder 3.2 (instead of 3.0)
Delete all the enters in the mm.cfg file
Add enter to the mm.cfg:
PreloadSwf=C:\work\labsense\Sources\ui\.metadata\.plugins\com.adobe.flash.profiler\ProfilerAgent.swf?host=localhost&port=9999
or
PreloadSwf=C:\work\labsense\Sources\ui\.metadata\.plugins\com.adobe.flash.profiler\ProfilerAgent.swf?host=localhost&port=9998
or
PreloadSwf=C:/work/labsense/Sources/ui/.metadata/.plugins/com.adobe.flash.profiler/ProfilerAgent.swf?host=localhost&port=9999
or with spaces:
PreloadSwf=C: \ work \ labsense \ Sources \ ui \ .metadata \ .plugins \ com.adobe.flash.profiler \ ProfilerAgent.swf?host=localhost&port=9999
or
C:\work\labsense\Sources\ui\.metadata\.plugins\com.adobe.flash.profiler\ProfilerAgent.swf?
or add all or some of the enters:
TraceOutputFileName=C:\Users\zivo\AppData\Roaming\Macromedia\Flash Player\Logs\flashlog.txt
ErrorReportingEnable=1
MaxWarnings=0
TraceOutputFileEnable=1
ProfilingFileOutputEnable=1
Turn on and off the vista firewall
Add exception for port 9999 in the vista firewall
Try to run the profiler SWF separately
Same result.
Try one last thing:
Because I have expreins problem little bit similar before with the flash debugger, the resolution then was:
Right click on flash player (debugger),
choose “Debugger”,
choose “other machine”
add “127.0.0.1”
click ok
then, it solve the issue (but apparently he connect to the debugger with host 127.0.0.1 instead of localhost (which is a same)
I now add to the mm.cfg file, the follow entry:
PreloadSwf=C:/work/labsense/branches/rel_1_2_5_EA/sources/ui/.metadata/.plugins/com.adobe.flash.profiler/ProfilerAgent.swf?host=127.0.0.1&port=9999
Then, after saving, I run the profiler, and its work!!
And the reasons for all this was:
Some program change the file C:\Windows\System32\drivers\etc\hosts to:
# Copyright (c) 1993-2006 Microsoft Corp.
#
# This is a sample HOSTS file used by Microsoft TCP/IP for Windows.
#
# This file contains the mappings of IP addresses to host names. Each
# entry should be kept on an individual line. The IP address should
# be placed in the first column followed by the corresponding host name.
# The IP address and the host name should be separated by at least one
# space.
#
# Additionally, comments (such as these) may be inserted on individual
# lines or following the machine name denoted by a '#' symbol.
#
# For example:
#
# 102.54.94.97 rhino.acme.com # source server
# 38.25.63.10 x.acme.com # x client host
::1 localhost
127.0.0.1 iDBO # LMS GENERATED LINE
This means that localhost is not lead to 127.0.0.1!!!
Fixing is easy:
# ::1 localhost
# 127.0.0.1 iDBO # LMS GENERATED LINE
127.0.0.1 localhost
Instead (remark the problem and fix the problem
After trying all the other suggestions here, this post on Adobe's forum clued me in.
Adobe forum
When the Flash debug player launches, it looks for mm.cfg in %HOMEDRIVE%%HOMEPATH%. On this particular computer that path is not my home directory on C: but on the file server mapped to I:. So once I created I:\mm.cfg with the contents
PreloadSwf=C:\Users\ehedstrom\Documents\FLEXBU~1\.metadata\.plugins\com.adobe.flash.profiler\ProfilerAgent.swf?host=localhost&port=9999
everything magically started working!
Browser tabs, make sure you have latest debug as you said you did, also make sure that the port is correct, for some reason the port sometimes changes(1001 or 20957) from the default 9999, be sure that your mm.cfg has ProfilingFileOutputEnable=1 and that bittorrent isn't on.
hth

Resources