Friday, January 28, 2011

Does the nginx “upstream” directive have a port setting?

moved from:http://stackoverflow.com/questions/3748517/does-nginx-upstream-has-a-port-setting

I use upstream and proxy for load balancing.

The directive proxy_pass http://upstream_name uses the default port, which is 80.

However, if the upstream server does not listen on this port, then the request fails.

How do I specify an alternate port?

my configuration:

http{
#...
upstream myups{
 server 192.168.1.100:6666;
server 192.168.1.101:9999;
}
#....
server{
listen 81;
#.....
location ~ /myapp {
 proxy_pass http://myups:81/;
}
}

nginx -t:

[warn]: upstream "myups" may not have port 81 in /opt/nginx/conf/nginx.conf:78.
  • You should set the port only in "server" statements inside "upstream" definition.

    (Which port does it listen on? 6666, 9999 or 81?)

  • I think you are misinterpreting the meaning of the line:

    proxy_pass http://myups;

    This line is telling nginx to pass the request to one of the servers listed in the 'upstream myups' block. It is not going back out on to the internet to send a request to URL for the proxy_pass.

    In other words, when a request come in to the nginx server on port 81 for the hostname you specified, it will pass the request on to either 192.168.1.100:6666, or 192.168.1.101:9999.

    Hope this clears it up a bit.

    From jammur

Network issues with DNS not being found

Hi there

This is exactly like how our network looks like:
Single server with a network router

Everything is setup, but I cannot connect our Macs under the Login Options -> Join... to this server. Our server's name is Toolbox and I have tried Toolbox.local, Toolbox.private, prepended the afp:// protocol to the name, but nothing, our Macs just don't want to connect this way. Our router has DHCP and gives out all the IP addresses naturally, would I have to add Toolbox.local to the DNS on the router and like it via static internal IP to the server?

Our Macs keep giving the following error while trying to join the Network Account Server:

Unable to add server
Could not resolve the address (2200)

What am I doing wrong?

  • According to your error message it is clearly a DNS issue.

    Some hints: Is the correct DNS passed to the clients with DHCP? What do the client DNS/network settings look like? Are they using the correct DNS? What does it say if you try to resolve the address with a "dig"? Does it work if you try joining the clients to the ip (for testing)?

    From Gomibushi
  • Check out the screenshots below. In the first, note the red highlighted area. Try that address. Also try the kerberos realm. Can you ping the server from the clients using the IP address and Toolbox.local? Don't append afp:// or anything to the url. You should set up a static IP for the server and set up the router to provide a PTR (reverse dns name) for the server. Send me a private message with your email address and I can help you out in more detail if you'd like.

    alt text alt text

Does Identity Management for Unix modify the AD schema?

We have a forest whose schema master is a 2008R2 DC (AD schema version if 47). I'd like to install Identity Management for Unix, but it's unclear to me whether or not this updates the AD schema. The server I plan to run IDMU and its NIS Server on is a 2003 R2 SP2 DC. The somewhat fuzzy impression I got from reading technet, etc was that it still makes some schema updates even if your DC is 2003R2+. Do I need to do this installation on my schema master first? We don't have the need to run this IDMU/NIS Server stuff on any of our other DC's.

How do you passthrough native SATA drives to a guest on ESXi?

I have ESXi 4.0 running on an Intel DX58S0 Mothboardboard with an Intel Core i7 930 processor. VT-d is also enabled.

I have three drives in the system, drive 0 is used for ESXi. Drive 1 and 2 contain data from an older machine and show up under the "Storage Adapters" section in configuration.

I would like to allow a guest machine to access the data on these drives (as nativly as possible). I have enabled passthrough of the motherboard's built in SATA controller (Intel/Marvell 88SE6121 ). This controller shows up in my guest OS, but the guest shows no drives aside from the normal virtual drive. I have tried a Linux guest and Windows7. I have also configured the host machine to try IDE/RAID/ACHI modes for the SATA controller.

Any ideas how I can configure one of my guests to get at the raw data on these drives?

  • I had a similar issue with some drives from a server that had failed, I found the answer on this page.http://www.vm-help.com/esx40i/SATA_RDMs.php

    It's far easier than controller pass-through or any of the other tricks I'd thought of, but you do need to be able to use the Service Console (google esxi unsupported mode ssh)

    summary:

    Step 1) fdisk -l to find the device name

    Step 2) ls /dev/disks -l to find the VML identifier

    Step 3) vmfstools -r VMLid aVMDKName.vmdk -a adaptertype

    Step 4) Add the aVMDKName.VMDK to a virtual machine.

    I wasn't able to boot off the disks as I had hoped to (P2V without copying 500GB across the network), but I was able to attach them to another virtual machine and get at the data.

    From Greg
  • The last answer is true but with some modification in commands

    Step 1) fdisk -l to find the device name

    Step 2) ls /dev/disks -l to find the VML identifier

    Step 3) vmkfstools -r VMLid VMDKName-withFullPath.vmdk(i.e. /vmfs/volumes/disk2/somename.vmdk) -a adaptertype -z /vmfs/devices/disks/vml.0200000000600508b1001037383941424344450d004c4f47494341:8

    Step 4) Add the VMDKName-withFullPath.vmdk to a virtual machine.

  • Another solution would be to perform the following:

    Step 1) Make sure remote tech support (SSH) is enabled and running. Step 2) SSH to the host Step 3) fdisk -l | grep -B4 'doesn't contain a valid partition table'

    Note: This will show you all the physical disks that don't have partitions yet, such as a newly-provisioned SAN LUN. It should look something like this:

    Disk /dev/disks/naa.60060e801004eb90052fab6900000000: 42.9 GB, 42949672960 bytes 255 heads, 63 sectors/track, 5221 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes

    Disk /dev/disks/naa.60060e801004eb90052fab6900000000 doesn't contain a valid partition table

    Disk /dev/disks/naa.60060e801004eb90052fab6900000001: 42.9 GB, 42949672960 bytes 255 heads, 63 sectors/track, 5221 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes

    Disk /dev/disks/naa.60060e801004eb90052fab6900000001 doesn't contain a valid partition table

    Disk /dev/disks/naa.60060e801004eb90052fab6900000002: 42.9 GB, 42949672960 bytes 255 heads, 63 sectors/track, 5221 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes

    Disk /dev/disks/naa.60060e801004eb90052fab6900000002 doesn't contain a valid partition table

    If this command doesn't show you any devices, my procedure probably isn't for you, as I, like the previous posters, make the assumption that the reason your VC "Raw Device Mappings" radio button is greyed-out is because the LUN doesn't have a partition.

    Step 4) Create a new partition, "fdisk /dev/disks/naa.60060e801004eb90052fab6900000000" Note: You'll have to use your own device name here. Step 5) If you're not too familiar with fdisk, you can do this:

    a) "p" to print existing partitions. If you don't see any, then it's probably safe to proceed.

    b) "n" to create a new partition.

    c) "p" for primary

    d) "1" for partition 1

    e) to select default start sector

    f) to select default end sector

    g) "w" to write

    h) "q" to quit

    Step 6) Now you should be able to assign the raw disk in VirtualCenter.

    From DrB

Force CPAN to download via HTTP

I'm about to lose my mind. How in the world do you tell CPAN to download via HTTP only? ...and NOT via a proxy.

  • Try these:

    Before running cpan: export -n http_proxy
    In the cpan shell: o conf http_proxy ''
    TO save your modified cpan config: o conf commit
    

    That will disable any http proxy CPAN is configured to use.

    From Jason
  • If you don't want to use a cpan shell, you can also edit your cpan config file with a text editor, in unix systems it's here:

    ~/.cpan/CPAN/MyConfig.pm

    Of course, the field to change in your particular question is 'http_proxy'.

    From toshiro
  • Try putting only HTTP URLs in your CPAN's Config.pm file, like:

    'urllist' => [q[http://cpan.cict.fr/], q[http://cpan.enstimac.fr/], q[http://mirrors4.kernel.org/cpan/]],
    

    I routinely do this and as far as I can see there's no FTP traffic to any CPAN mirror.

.htaccess redirect doens't work correctly

Hi,

I'm using a .htaccess to get all documents from an old site to the new one. The old site doesn't support PHP or mod_rewrite. I tried the following code:

Redirect 301 / http://www.new.com/archive/

I requested " http://www.new.com/archive/index.html" Which resulted into

http://www.new.com/archive/old.com/olddir/&&&/&&&/users/4/web/00/00/24/04/44/&&&/1/&&&/0/&&&/&&&/&&&/users/4/web/00/00/24/04/44/&&&/1/&&&/0/&&&/index.html

Is this possible to solve?

  • Kevin -

    At first glance, it looks like something within your application is doing quite a few redirects. The simple Redirect statement in your .htaccess shouldn't be creating the very long URL that you pasted above.

    It may help you debug the issue if you use curl to test it:

    $ curl -I olddomain.com | grep ^Location
    Location: http://newdomain.com/archive/olddomain.com/
    

    From there, just curl the URL that is returned and see where you're redirected then. Take the next URL and curl it as well. Keep going until you are able to debug the source of those redirects.

Using dot (.) as delimiter to specify group in chown

I've always done:

chown nimmylebby:admins file

I see that this also works:

chown nimmylebby.admins file

Might seem like a silly question but I'm genuinely curious on how the latter works. It isn't documented in my chown's manpage (GNU coreutils 8.4, 10/10). Is this perhaps a Bash interpretation? Or a deprecated format for the argument?

  • Hi,

    from the chown(8) manpage on macos x 10.6.4.

    COMPATIBILITY
         Previous versions of the chown utility used the dot (``.'') character to distin-
         guish the group name.  This has been changed to be a colon (``:'') character, so
         that user and group names may contain the dot character.
    

    Good question, I learned something today ;)

    From nayden
  • From info coreutils 'chown invocation' for GNU coreutils:

    Some older scripts may still use '.' in place of the ':' separator. POSIX 1003.1-2001 (*note Standards conformance::) does not require support for that, but for backward compatibility GNU 'chown' supports '.' so long as no ambiguity results. New scripts should avoid the use of '.' because it is not portable, and because it has undesirable results if the entire OWNER'.'GROUP happens to identify a user whose name contains '.'.