Solved

Error with Lighttpd

Posted on 2010-09-18
7
270 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
  • 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 109

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
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 
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 109

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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

One of the typical problems I have experienced is when you have to move a web server from one hosting site to another. You normally prepare all on the new host, transfer the site, change DNS and cross your fingers hoping all will be ok on new server…
Introduction This article explores the design of a cache system that can improve the performance of a web site or web application.  The assumption is that the web site has many more “read” operations than “write” operations (this is commonly the ca…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to dynamically set the form action using jQuery.

831 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