?
Solved

Error with Lighttpd

Posted on 2010-09-18
7
Medium Priority
?
290 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 2000 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 111

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
Get your Conversational Ransomware Defense e‑book

This e-book gives you an insight into the ransomware threat and reviews the fundamentals of top-notch ransomware preparedness and recovery. To help you protect yourself and your organization. The initial infection may be inevitable, so the best protection is to be fully prepared.

 
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 111

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

Plesk WordPress Toolkit

Plesk's WordPress Toolkit allows server administrators, resellers and customers to manage their WordPress instances, enabling a variety of development workflows for WordPress admins of all skill levels, from beginners to pros.

See why 2/3 of Plesk servers use it.

Question has a verified solution.

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

Meet the world's only “Transparent Cloud™” from Superb Internet Corporation. Now, you can experience firsthand a cloud platform that consistently outperforms Amazon Web Services (AWS), IBM’s Softlayer, and Microsoft’s Azure when it comes to CPU and …
Since pre-biblical times, humans have sought ways to keep secrets, and share the secrets selectively.  This article explores the ways PHP can be used to hide and encrypt information.
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
Suggested Courses

718 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