Solved

Error with Lighttpd

Posted on 2010-09-18
7
280 Views
Last Modified: 2012-06-21
Hello

I am adding the following lines in lighttpd.conf

server.modules += ( "mod_setenv" )
setenv.add-request-header = ( "X-Proxy" => server.name )

But when reloading getting following error:

Reloading web server configuration: lighttpdUndefined config variable: server.name

But when change it to following it works fine

server.modules += ( "mod_setenv" )
setenv.add-response-header = ( "X-Proxy" => "www-02" )

It is not getting  server.name. I have got this example from http://www.cyberciti.biz/faq/mod_setenv-lighttpd-send-custom-headers/ and trying to implement at my place but failing.

Please help

0
Comment
Question by:systemsautomation
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
  • 2
7 Comments
 
LVL 4

Accepted Solution

by:
trencH87 earned 500 total points
ID: 33707702
In your config, add this line above the ones you posted here.

Change the "ex" to whatever you want your server name to be.

server.name = “ex”

Open in new window

0
 

Author Comment

by:systemsautomation
ID: 33707711
Thanks for the answer

Actually I want to put the client's IP address to this variable. Can you please guide me ?
0
 
LVL 110

Expert Comment

by:Ray Paseur
ID: 33708305
In correctly configured PHP on a LAMP stack you can usually find the client's IP address here:

$_SERVER["REMOTE_ADDR"]    

It is a string that looks something like this:

98.169.58.122

This is not 100% foolproof, but I have found it to be pretty reliable.  HTH, ~Ray
0
Back Up Your Microsoft Windows Server®

Back up all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

 
LVL 4

Expert Comment

by:trencH87
ID: 33749102
Read the question first, Ray ;o)

To the last question: Change the server.name to server.bind in both lines: "X-Proxy" => server.name becomes "X-Proxy" => server.bind and server.name = "servername" becomes server.bind = "IP-address"

Best of luck!

Chris
0
 
LVL 110

Expert Comment

by:Ray Paseur
ID: 33749667
Well, it was posted in the PHP zone, and the Asker wrote, "Actually I want to put the client's IP address to this variable."  Guess you can't please everyone!
0
 
LVL 4

Expert Comment

by:trencH87
ID: 33749683
Hehe, true true.
0
 

Author Comment

by:systemsautomation
ID: 33750998
Hello trencH87

Your solution is quite closer and may be perfect as per this question's scope.

But the task I want to do ultimately is that I want to pass the User's IP (not server's) to a new CGI Variable. I have opened a new question for this and will be really thankful If you can help:

http://www.experts-exchange.com/Software/Server_Software/Web_Servers/Apache/Q_26495831.html
0

Featured Post

The Eight Noble Truths of Backup and Recovery

How can IT departments tackle the challenges of a Big Data world? This white paper provides a roadmap to success and helps companies ensure that all their data is safe and secure, no matter if it resides on-premise with physical or virtual machines or in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When it comes to showing a 404 error page to your visitors, you do not want that generic page to show, and you especially do not want your hosting provider’s ad error page to show either. In this article, I will show you how to enable the custom 40…
Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

734 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question