I am on Windows 7, using Apache 2.2.29.
I modified my httpd.conf file to load moduels for mod-info.so and mod-status.so
and in my extra/httpd-info.conf, I updated server-status and server-info Location stancas to allow from
So, in my httpd.conf, I uncommented these:
LoadModule info_module modules/mod_info.so
LoadModule status_module modules/mod_status.so
and in my extra/httpd-info.conf, I modified as below to add my ip-address in "Allow from":
<Location /server-status>
SetHandler server-status
Order deny,allow
Deny from all
Allow from my-ip-address:no-port#
</Location>
<Location /server-info>
SetHandler server-info
Order deny,allow
Deny from all
Allow from my-ip-address-no-port
</Location>
If I just enter my-ip-address:my-port in browser, I get
"It Works!"
However, when I try to get info and status of my server, I get
for server-info:
Not Found
The requested URL /server-info was not found on this server.
for server-status:
Forbidden
You don't have permission to access /server-status on this server.
I am new to Apache, please provide explanation.
Much appreciated,
On modern windows, If you edit httpd.conf from your normal user account you can end up creating a 2nd copy specific to your userid that the server doesn't see. Make sure to edit it as Administrator.
Related
I have multiple projects based on PHP. Some require PHP version 5.x to run and other strictly require PHP 7.0 or above. I am working on these simultaneously. Is there a way to run multiple PHP versions such that I can switch between them when working on different projects.
Try these steps:
Stop LAMP if running.
Download libphp7.so if you don't have
https://github.com/prashant-techindustan/php7module_library/blob/master/libphp7.so
Edit /opt/lampp/etc/extra/httpd-xampp.conf (Comment out one of the following which is not needed):
LoadModule php5_module modules/libphp5.so
LoadModule php7_module modules/libphp7.so
Start LAMP
>> Open C:\xampp\apache\conf\extra\httpd-xampp.conf
>> Write Following code at Bottom of this (httpd-xampp.conf) file
ScriptAlias /php56 "C:/xampp/php56"
<Directory "C:/xampp/php56">
AllowOverride None
Options None
Require all denied
<Files "php-cgi.exe">
Require all granted
</Files>
</Directory>
>> Open C:\xampp\apache\conf\extra\httpd-vhosts.conf\httpd-vhosts.conf
>> Create a virchual host in Different post By Writing Following code
<VirtualHost *:8081>
UnsetEnv PHPRC
<FilesMatch "\.php$">
php_flag engine off
SetHandler application/x-httpd-php5_6
Action application/x-httpd-php5_6 "/php5_6/php-cgi.exe"
</FilesMatch>
DocumentRoot "C:/xampp/htdocs/myphp5_6_project"
</VirtualHost>
>> Create a folder "myphp5_6_project" in htdocs of xampp
>> Open C:\xampp\apache\conf\httpd.conf
>> Write Listen 8081 (any where or Below Listen 80 line)
>> Restart Apache Services
I am trying to enable mod_status on my server. I have mod_status.so module installed and the relevant part of my .conf file is (I plan to restrict access to only my IP once I get it running):
LoadModule status_module modules/mod_status.so
<Location /server-status>
SetHandler server-status
Order Allow,Deny
Allow from all
</Location>
I restart apache and get an error: "Syntax error on line 4 of /path/to/httpd.conf"...which points to the line:
Order Allow,Deny
I've tried all combinations of lowercase, uppercase and a space between the comma and "Deny". What am I doing wrong?
I am using Apache 2.2.25 (and I do have 2 virtualhosts)
Thanks!
Previously I used the IIS server as PHP server. Currently, it is the apache.
On IIS I could access to the variable $_SERVER ['REMOTE_USER'] which returns the username and domain (eg domain\user) but after installing XAMPP this variable is not available.
What I should do to get this variable get again?
My app is on local network with no-internet connection
Finally got it to works! :D
Download the module from here https://www.apachehaus.net/modules/mod_authnz_sspi/ (x86 for 32 bit and x64 for 64 bit apache)
Copy the mod_authnz_sspi.so from Apache24\modules folder and place it in the modules folder of your Apache folder on your webserver
Under the httpd.conf file (Config file for your apache) place this line of code. Try to load this as the last module:
LoadModule authnz_sspi_module modules/mod_authnz_sspi.so
Make sure that the following modules are uncommented
LoadModule authn_core_module modules/mod_authn_core.so
LoadModule authz_core_module modules/mod_authz_core.so
PS: both the above modules are required for this to work.
Place the following code in your httpd.conf file
<Directory "path/to/your/htcdocs/folder">
Options None
AllowOverride All
Order allow,deny
Allow from all
#AuthName "SSPI Protected Place"
AuthType SSPI
SSPIAuth On
SSPIAuthoritative On
SSPIOfferBasic On
SSPIOmitDomain On
Require valid-user
</Directory>
Restart your apache servive and hopefully it should restart without any issues.
Now in order to recognise the user , use the following code on a php page
echo $_SERVER['PHP_AUTH_USER'];
That's all.
I'm using:
XAMPP Control Panel 3.2.1
APACHE 2.4
<Directory "path/to/your/htcdocs/folder">
Options None
AllowOverride All
Order allow,deny
Allow from all
#AuthName "SSPI Protected Place"
AuthType SSPI
SSPIAuth On
SSPIAuthoritative On
SSPIOfferBasic On
SSPIOmitDomain On
Require valid-user
</Directory>
If you use ModRewrite or other I suggest you to keep
Options Indexes FollowSymLinks Includes ExecCGI
otherwise you'll get an error like
[rewrite:error]: Options FollowSymLinks and SymLinksIfOwnerMatch are both off, so the RewriteRule directive is also forbidden due to its similar ability to circumvent directory restrictions
You can only access the remote user if Apache has actually authenticated the user, check the apache auth howto.
I battled with this for a long time, it turned out that I had to install VC redistributable to make it work.
I am trying to get mod_status set up on my apache 2.4 server. I have trawled the net for hours but all the examples given just show the tags in the main httpd.conf file, not how to place the directives into a virtual host setup.
This is my virtual host config with what I have tried. When I do this and then open a local browser or a browser from my allowed ip address (my remote public address) I get a forbidden error in the browser.
<VirtualHost *:80>
ServerName www.thevmscloud.com
ServerAlias thevmscloud.com
ServerAdmin admin#thevmscloud.com
DocumentRoot "d:/wamp/webdocs/www/"
ErrorLog "logs/www.thevmscloud.com.log"
CustomLog "logs/www.thevmscloud.com.log" common
<Location /server-status>
SetHandler server-status
Order deny,allow
Deny from all
Require host 127.0.0.1 81.133.136.16
</Location>
<Directory "d:/wamp/webdocs/www/">
LogLevel crit
Options Indexes FollowSymLinks Includes ExecCGI
AllowOverride all
Order Allow,Deny
Allow from all
Require all granted
</Directory>
I have tried all manner of different combinations of settings commented in/out, location block with the virtual host block, outside it, in the httpd.conf main body and still no joy.
Trouble is, I just cant find an example of this setup anywhere. Some posts say 'you might want to add this to you virtual host config' but then dont show how.
Does anybody have any idea how this is to be configured so I can browse to my domain.com/server-status and see the server stats as expected?
Many thanks
Mark
Change it to this:
<Location /server-status>
SetHandler server-status
Require ip 127.0.0.1
Require ip ::1
Require ip 81.133.136.16
</Location>
Don't use require "host" if you don't need it because it will try to resolve it (especially for localhost)
Check the error logs also.
The ::1 is localhost for IPv6, you probably need it.
to access the server status by the name of the virtual host, and not by localhost/127.0.0.1, please see my configuration:
<IfModule mod_status.c>
<Location /server-status>
SetHandler server-status
Order deny,allow
Allow from 127.0.0.1
Allow from ::1
</Location>
</IfModule>
Allow from addresses the location of the client being on the same host, and not the address by which you are calling the server, given that different virtual boxes with different server addresses share the same localhost computer.
since i have only one virtual box, i don't know yet whether the returned data comes split per different virtual boxes. if you know it please edit this post or leave a comment.
please note, that trying to access http(s)://hostname/server-status from other address failed with status 403 and the log showed the misterious: AH01797: client denied by server configuration. in the end, i couldn't access the status from outside, even when i let Allow from all, but it wasn't that important to me.
hope that helps
https://httpd.apache.org/docs/2.4/mod/mod_authz_host.html#requiredirectives
In place of ::1 and 127.x or localhost
<Location /server-status>
SetHandler server-status
Require local
Require ip 81.133.136.16
</Location>
I've gone through the Apache guide to enable to mod_info.
As per doc:
To configure mod_info, add the following to your httpd.conf file.
<Location /server-info>
SetHandler server-info
</Location>
You may wish to use mod_access inside the <Location> directive to limit access to your server configuration information:
<Location /server-info>
SetHandler server-info
Order deny,allow
Deny from all
Allow from yourcompany.com
</Location>
Once configured, the server information is obtained by accessing
http://your.host.dom/server-info
In my case this link is not giving any info. Is there anything I need to install as mod_info.c or something? Is there anything I need to put as AddModule or something?
There should be a mod_info.so that must be on a path Apache 2 can find. For example, I have:
kdp#darwin ccl $ locate mod_info.so
/usr/lib64/apache2/modules/mod_info.so
Then, I have these in my httpd.conf:
ServerRoot "/usr/lib64/apache2"
LoadModule info_module modules/mod_info.so
This is made available by a snippet in /etc/apache2/modules.d/00_mod_info.conf:
<IfDefine INFO>
# Allow remote server configuration reports, with the URL of
# http://servername/server-info
<Location /server-info>
SetHandler server-info
Order deny,allow
Deny from all
Allow from 127.0.0.1
</Location>
</IfDefine>
(The IfDefine is only needed because of the way stuff is set up on Gentoo.)
Check if info_module is loaded.
% /usr/local/sbin/httpd -t -D DUMP_MODULES | grep info_module
If it is not loaded, add following line to httpd.conf. Note that path/to must be replaced with appropriate path.
LoadModule info_module path/to/mod_info.so
I got the solution.
When I check ./apachectl -l, mod_info has not been installed.
To install the Mod_info or any module, First Compile and install Apache by ./configure --enable-info make make install
More info for install module : http://publib.boulder.ibm.com/httpserv/manual60/install.html
Check ./apachectl -l, mod_info would be there in the list
Enable server-info by updating httpd.conf
invoke url http://your.host.dom/server-info
One thing I am not sure why apache mod_info not installed default installation.