recentpopularlog in

kme : apache   196

« earlier  
PHP: Installation - Manual
PHP is glue. It is the glue used to build cool web applications by sticking dozens of 3rd-party libraries together and making it all appear as one coherent entity through an intuitive and easy to learn language interface. The flexibility and power of PHP relies on the stability and robustness of the underlying platform. It needs a working OS, a working web server and working 3rd-party libraries to glue together. When any of these stop working PHP needs ways to identify the problems and fix them quickly. When you make the underlying framework more complex by not having completely separate execution threads, completely separate memory segments and a strong sandbox for each request to play in, further weaknesses are introduced into PHP's system.

If you want to use a threaded MPM, look at a FastCGI configuration where PHP is running in its own memory space.
php  apache  mpm_prefork  mpm_worker  mpm_event  webmaster  explained  solution 
8 days ago by kme
How can I set Apache to serve files as text? - Server Fault
<code class="language-apache"><Location "/programfiles">
ForceType text/plain

Better solution, though:
<code class="language-apache">AddType text/plain .c
AddType text/plain .h</code>
apache  webmaster  dammitbrain  contenttype  mimetype  solution 
7 weeks ago by kme
%2F slash encoding issues · Issue #399 · jenkinsci/gitlab-plugin |
I think the deal is that our front-end proxy needs "AllowEncodedSlashes NoDecode" set in its config.
webmaster  apache  PATH_INFO  maybesolution 
december 2019 by kme
apache - Apache2 ProxyPass for Rails App Gitlab - Stack Overflow
The problem I was having was a route that matched "/icons," and it was trying to serve GitLab's 'icons-[HASH].svg' from the filesystem, which resulted in a 404.
webmaster  gitlab  apache  rails  proxy  config  reference 
december 2019 by kme
Apache Redirect Root URL to Subfolder – Limited |
I had this bit of configuration in my /etc/httpd/conf.d/something.conf, but I'm not sure if it ever did anything other than "pass through" (if you look at the logs).

Anyways, for posterity:
<code class="language-apache">
# Make all requests to the root go to /wiki. A 'Redirect' (mod_alias)$
# isn't appropriate here because that *also* passes the "path" part of$
# the request, which would lead to a recursive redirect.$
# Source:
RewriteEngine on
RewriteCond %{REQUEST_URI} ^/$
RewriteRule (.*) /wiki/ [R=301]
webmaster  apache  httpd  rewrite  mediawiki  maybesolution 
november 2019 by kme
php - Alternatives to apache_get_modules() to get list of loaded apache modules - Stack Overflow |

* phpinfo() will tell you how PHP is installed, especially the Server API row.
* You could parse the config files for Apache to find out which modules are configured.
* You could run something like apache2 -t -D DUMP_MODULES to obtain a list of modules.
apache  webmaster  modules  annoyance  solution 
november 2019 by kme
httpd24-mod_ldap-2.4.34-7.el6.1.x86_64.rpm CentOS 6 Download |
Install Howto
<code class="language-bash">
# Install CentOS SCLo RH repository:
yum install centos-release-scl-rh

# Install httpd24-mod_ldap rpm package:
yum install httpd24-mod_ldap
webmaster  apache  apache24  ldap  module  centos  centos7  scl  packagemanagement  annoyance  solution 
november 2019 by kme
apache 2.2 - Difference between mod_authn_ldap and mod_authz_ldap - Server Fault |
mod_authz_ldap seems to be a third-party module that *only* does authorization (not authentication)--whatever that means.
apache  apache22  httpd  ldap  modules  webmaster  maybesolution 
november 2019 by kme
mod_authnz_ldap - Apache HTTP Server Version 2.2 |
<code class="language-apache">
<Directory "/var/www/html/someresource">
Order deny,allow
Deny from All
Require valid-user
Satisfy any

AuthName "Some Resource"
AuthType Basic
AuthBasicProvider ldap
# pass bad users/passwords off onto the "file" provider
AuthzLDAPAuthoritative off
AuthBasicProvider file
AuthUserFile /var/www/htpasswd

Require ldap-group CN=group1,OU=DP,OU=dept,DC=subdomain,DC=domain,DC=org
Require ldap-group CN=group2,OU=DP,OU=dept,DC=subdomain,DC=domain,DC=org
Require ldap-group CN=group3,OU=DP,OU=dept,DC=subdomain,DC=domain,DC=org
AuthLDAPGroupAttribute memberOf

AuthLDAPUrl "ldap://,OU=Managed,DC=chmcres,DC=cchmc,DC=org?uid?sub?(objectclass=organizationalPerson)"
# 2.4.x should allow multiple URLs

# not supported until 2.3.x
AuthLDAPBindDN "CN=ldapuser,OU=ServiceAccounts,DC=subdomain,DC=domain,DC=org"
AuthLDAPBindPassword "ThisIsThePasswordForThat"
# vim: ft=apache
webmaster  apache  httpd  authorization  ldap  configfile  solution 
november 2019 by kme
Force your site to load securely with an .htaccess file – DreamHost |
<code class="language-apache">
RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301,NE]
https  apache  redirect  dreamhost  hosting  webmaster  solution 
november 2019 by kme
Installation Problems · Issue #716 · klaussilveira/gitlist |
I think that this problem is related to apache virtual host configuration.
Try to find in your apache virtual host configuration something like:
<code style="lang-apache"><Directory ...> AllowOverride None </Directory></code>
Change it to
<code style="lang-apache"><Directory ...> AllowOverride All </Directory></code>
gitlist  php  apache  errormessage  solution 
february 2019 by kme
Apache Bench and Gnuplot: you’re probably doing it wrong |
<code># Let's output to a jpeg file
set terminal jpeg size 500,500
# This sets the aspect ratio of the graph
set size 1, 1
# The file we'll write to
set output "graphs/sequence.jpg"
# The graph title
set title "Benchmark testing"
# Where to place the legend/key
set key left top
# Draw gridlines oriented on the y axis
set grid y
# Label the x-axis
set xlabel 'requests'
# Label the y-axis
set ylabel "response time (ms)"
# Tell gnuplot to use tabs as the delimiter instead of spaces (default)
set datafile separator '\t'
# Plot the data
plot "data/testing.tsv" every ::2 using 5 title 'response time' with lines
apache  benchmarking  performance  gnuplot  visualization  webmaster  sysadmin 
december 2018 by kme
how to display local shell-script/s in browser/firefox? - Unix & Linux Stack Exchange |
The way data is processed in a browser depends on the MIME type declared by the server. If you want your browser to render it as html, which is most likely a terrible idea, you can change the Content-Type header the server returns so that it reflects the type of your data, which would be text/html; charset=utf-8, and the Content-Disposition header to suggest the browser what to do.

My solution was the following (in a '.htaccess'):
<code class="language-apache">
<Files *.sh>
SetEnvIf Request_URI "([^/]+\.sh)" FileName=$1

# ref:
Header set Content-Type "text/plain"

# not needed, and doesn't work alone, since the browser is configured to
# download "application/sh" rather than display it inline; just telling the
# browser it's "text/plain" is enough to achieve the aim
#Header set Content-Disposition "inline; filename=\"%{FileName}e\""
firefox  browser  mimetype  contentdisposition  webmaster  apache  configuration  solution 
november 2018 by kme
http headers - How do I force files to open in the browser instead of downloading (PDF)? - Stack Overflow |
To indicate to the browser that the file should be viewed in the browser:
Content-Type: application/pdf
Content-Disposition: inline; filename="filename.pdf"

To have the file downloaded rather than viewed:
Content-Type: application/pdf
Content-Disposition: attachment; filename="filename.pdf"

The quotes around the filename are required if the filename contains special characters such as filename[1].pdf which may otherwise break the browser's ability to handle the response.
httpd  apache  webmaster  headers  contentdisposition  sortof  solution 
november 2018 by kme
webdav - How do I enable HTTP-DAV in Apache? - Server Fault |
Yup, I made this mistake, too:
I finally figured it out.

Instead of
<code class="language-apache"><Location /var/www/html/updates>
Dav On

it needs to be (Directory instead of Location)
<code class="language-apache"><Directory /var/www/html/updates>
Dav On
apache  webmaster  configfile  webdav  solution  fuckina 
august 2018 by kme
Change Apache httpd "Server:" HTTP header - Unix & Linux Stack Exchange |
I simply changed the directives in security.conf and Apache started working as I wanted.
<code class="language-apache">
ServerTokens Prod
ServerSignature Off
webmaster  apache  httpd  config  configfile  security  configuration  solution  dammitbrain 
may 2018 by kme
Manual:Short URL/Apache - MediaWiki |
In the Apache config (for the vhost or whatever):
<code class="language-apache">##

# Enable the rewrite engine
RewriteEngine On

# Short URL for wiki pages
RewriteRule ^/?wiki(/.*)?$ %{DOCUMENT_ROOT}/w/index.php [L]

# Redirect / to Main Page
RewriteRule ^/*$ %{DOCUMENT_ROOT}/w/index.php [L]

In 'LocalSettings.php':
<code class="language-php">
$wgScriptPath = "/w"; // this should already have been configured this way
$wgArticlePath = "/wiki/$1";
mediawiki  essential  movein  shorturl  configfile  webmaster  apache  solution 
may 2018 by kme
how do I allow mysql connections through selinux - Server Fault |

To check SELinux
<code class="language-bash">sestatus</code>

To see what flags are set on httpd processes
<code class="language-bash">getsebool -a | grep httpd</code>

To allow Apache to connect to remote database through SELinux
<code class="language-bash">setsebool httpd_can_network_connect_db 1</code>

Use -P option makes the change permanent. Without this option, the boolean would be reset to 0 at reboot.
<code class="language-bash">
setsebool -P httpd_can_network_connect_db 1

See also, because I got that exact error message:

/var/www/html/Wiki/includes/ line 61: ulimit: cpu time: cannot modify limit: Permission denied

/var/www/html/Wiki/includes/ line 90: ulimit: file size: cannot modify limit: Permission denied</code>

If you want to create a policy file that allows whatever was failing to not fail, try this:

<code class="language-bash">grep httpd /var/log/audit/audit.log | audit2allow -M mypol
semodule -i mypol.pp</code>
selinux  centos  apache  httpd  mysql  security  sysadmin  webmaster  solution  errormessage 
may 2018 by kme
linux - You don't have permission error in Apache in CentOS - Stack Overflow -
This is a common problem, and this is a good tip:
ps axo user,group,comm | grep apache

Also, check "getenforce" to see if SELinux is the problem.
centos  apache  httpd  annoyance  webmaster  syadmin  permissions  solution 
october 2017 by kme
http - Access-Control-Allow-Origin Multiple Origin Domains? - Stack Overflow

Sounds like the recommended way to do it is to have your server read the Origin header from the client, compare that to the list of domains you'd like to allow, and if it matches, echo the value of the Origin header back to the client as the Access-Control-Allow-Origin header in the response.

With .htaccess you can do it like this:

# ----------------------------------------------------------------------
# Allow loading of external fonts
# ----------------------------------------------------------------------
<FilesMatch "\.(ttf|otf|eot|woff)$">
<IfModule mod_headers.c>
SetEnvIf Origin "http(s)?://(www\.)?(||||$" AccessControlAllowOrigin=$0
Header add Access-Control-Allow-Origin %{AccessControlAllowOrigin}e env=AccessControlAllowOrigin

cors  webmaster  apache  security  config 
september 2017 by kme
mod_wsgi (Apache) — Flask Documentation (0.12) []
Working with Virtual Environments
Virtual environments have the advantage that they never install the required dependencies system wide so you have a better control over what is used where. If you want to use a virtual environment with mod_wsgi you have to modify your .wsgi file slightly.

Add the following lines to the top of your .wsgi file:

activate_this = '/path/to/env/bin/'
execfile(activate_this, dict(__file__=activate_this))
For Python 3 add the following lines to the top of your .wsgi file:

activate_this = '/path/to/env/bin/'
with open(activate_this) as file_:
exec(, dict(__file__=activate_this))
flask  python  webdevel  webmaster  deployment  apache  mod_wsgi  config  solution 
august 2017 by kme
mod_wsgi 4.5.17 : Python Package Index []
LoadModule wsgi_module /usr/local/lib/python2.7/site-packages/mod_wsgi/server/
WSGIPythonHome /usr/local/lib
centos  python  wsgi  mod_wsgi  apache  webmaster  solution 
august 2017 by kme
how to set LD_LIBRARY_PATH on VPS red-hat linux to be visible by apache - Server Fault
Turns out you can just 'source /opt/rh/python27/enable' in /etc/sysconfig/httpd. That works fine on CentOS 6.
apache  webmaster  centos  solution 
august 2017 by kme
Apache: Enable PHP in UserDir - Code Diary
The next step is enable the execution of PHP scripts inside public_html. To do that, as root, open the file /etc/apache2/mods-enabled/php5.conf and find the following lines:

<IfModule mod_userdir.c>
<Directory /home/*/public_html>
php_admin_value engine Off

On CentOS 6, doing this but specifying 'php_admin_value engine on' actually made the problem worse. Whatever problem I thought I had wasn't this.
apache  configfile  webmaster  debian  sortof  solution 
july 2017 by kme
mozilla_sync causes lots of errors "user not found" in /etc/apache2/error.log · Issue #76 · owncloudarchive/mozilla_sync · GitHub
In the case of CentOS 6, you probably want to put this in /etc/httpd/conf.d/
Try the following:

<Location /owncloud>
AllowOverride All
Order allow,deny
Allow from all
apache  configfile  webmaster  owncloud  webdav  errormessage  solution 
may 2017 by kme
Version 3.4 — mod_wsgi 4.5.14 documentation
And of course Amazon's AMI distro uses a 3.2.x version of mod_wsgi that doesn't have this.
4. Added ‘python-home’ option to WSGIDaemonProcess allowing a Python virtual environment to be used directly in conjunction with daemon process. Note that this option does not do anything if setting WSGILazyInitialization to ‘Off’.
python  virtualenv  mod_wsgi  apache  solution 
february 2017 by kme
django - (13)Permission denied: mod_wsgi Unable to connect to WSGI - Stack Overflow
The solution is discussed here (, and that's to specify a WSGISocketPrefix inside /var/run:
WSGISocketPrefix /var/run/wsgi

Stupid CentOS. Why couldn't they just put that line in /etc/httpd/conf.d/wsgi.conf in the first place?
python  mod_wsgi  apache  errormessage  solution 
february 2017 by kme
python - Django + mod_wsgi. Set OS environment variable from Apache's SetEnv - Stack Overflow
I solved this problem by changing to this:

from django.core.handlers.wsgi import WSGIHandler
import django
import os

class WSGIEnvironment(WSGIHandler):

def __call__(self, environ, start_response):

os.environ['USKOVTASK_PROD'] = environ['USKOVTASK_PROD']
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "uskovtask.settings")
return super(WSGIEnvironment, self).__call__(environ, start_response)

application = WSGIEnvironment()
apache  django  webdevel  webmaster  mod_wsgi  environmentvariables  envvars  maybesolution 
february 2017 by kme
linux - What are the recommended runlevels for httpd? - Super User
Don't believe everything you read on Wikipedia.

Taken from a live, recently installed CentOS 6 system: The network is started in runlevels 2, 3, 4 and 5.

# chkconfig --list network
network 0:off 1:off 2:on 3:on 4:on 5:on 6:off

As a practial matter, only runlevels 3 and 5 ever really get used. Runlevel 3 is the usual "no-graphical-desktop" runlevel, while runlevel 5 is used to start a graphical desktop.

Still dunno why Apache doesn't just configure itself to run by default after you install it (Amazon AMI).
apache  httpd  centos  amazonami  dammitbrain  runlevels  startup 
february 2017 by kme
httpd.conf - Apache Proxy: No protocol handler was valid - Stack Overflow
In my case, it was 'proxy_balancer' that needed to be enabled with 'a2enmod'.
This can happen if you don't have mod_proxy_http enabled

sudo a2enmod proxy_http

For me to get my https based load balancer working, i had to enable the following:

sudo a2enmod ssl
sudo a2enmod proxy
sudo a2enmod proxy_balancer
sudo a2enmod proxy_http
apache  webmaster  debian  errormessage  solution 
november 2016 by kme
Apache redirect to another port - Stack Overflow []
You should leave out the domain in ProxyPass and ProxyPassReverse and leave it as /. Additionally, you need to leave the / at the end of example/ to where it is redirecting. Also, I had some trouble with vs. - only the www worked until I made the ServerName, and the ServerAlias Give the following a go.

<VirtualHost *:80>
ProxyPreserveHost On
ProxyRequests Off
ProxyPass / http://localhost:8080/example/
ProxyPassReverse / http://localhost:8080/example/
apache  proxy  webmaster  hosting  webserver  solution 
november 2016 by kme
python - Passing apache2 digest authentication information to a wsgi script run by mod_wsgi - Stack Overflow []
<VirtualHost *>
<Location />
AuthType Digest
AuthName "global"
AuthDigestDomain /
AuthUserFile /root/apache_users
<Limit GET>
Require valid-user
WSGIPassAuthorization On
WSGIScriptAlias / /some/script.wsgi
WSGIDaemonProcess mywsgi user=someuser group=somegroup processes=2 threads=25
WSGIProcessGroup mywsgi
apache  mod_wsgi  wsgi  python  webmaster  authentication  maybesolution 
november 2016 by kme
Configuring virtual hosts on different ports for your Apache server | Bruno Lowagie's Online Gazette
So changing the port like "<VirtualHost *:81>" isn't enough; you have to remember to put "Listen 81" in the global scope as well.

It seems sufficient to just put this at the top of a /etc/apache2/sites-available/990-vhost-whatever.conf config file.
webmaster  apache  vhost  virtualhost  configfile  solution 
october 2016 by kme
Painless subdomains on your laptop :: Software architect Kristof Kovacs
See also:
<VirtualHost *:80>
VirtualDocumentRoot /Users/kkovacs/Sites/%1
ServerName automated_domains
ServerAlias *
webdevel  apache  virtualhosts  configfile  tipsandtricks  webmaster  solution 
july 2016 by kme
routing - How to serve static files using Klein.php - Stack Overflow
Another Option

One final thing I should note. If this is what you're really trying to do, rather than a simplified example, you may be able to accomplish the same thing with Apache mod_rewrite, or the equivalent in Nginx, and have better performance, since you're not executing any PHP code at that point. On the other hand, if you want to do something more advanced, like checking the user's login credentiails before deciding whether to serve the file, or serve files outside your document root, the way you're doing it is probably spot on.

I'm not very good at writing mod_rewrite rules, but I think you could do something like:

RewriteRule ^/web/(.+) /your/desired/path/$1 [R,L]

assuming the destination is web-accessible. Reference:

Or, if it's not web-accessible, it looks like you could setup an alias:
apache  rewriterule  redirection  statichtml  hosting  webserver  webmaster  webdevel  php  routing  altorouter  solution 
june 2016 by kme
Serving PHP with Apache: AddType and AddHandler - Apache Web Server forum at WebmasterWorld - WebmasterWorld
"You're also fighting "institutionalized" confusion between the very-different functions of AddType (which defines the MIME-type header to be returned with content to the client), and AddHandler, which tells the server how to handle each filetype in the server's filespace.

The examples posted above demonstrate this "institutionalized" confusion; Although the use "AddHandler application/x-httpd-php .php" to declare a MIME-type as a content-handler is glaringly nonsensical, the fact is that it will work on some servers."

And once I discovered the above information, lo and behold, what do I find on the Apache wiki for PHP4/PHP5 []? I find instructions to add the following to httpd.conf:

LoadModule php5_module modules/
AddHandler application/x-httpd-php .php .phtml
Action application/x-httpd-php modules/

So the "Action application/x-httpd-php modules/" directive here was the missing piece to the puzzle all along!
webmaster  php  apache  wtf  confusion  reference  maybesolution 
february 2016 by kme
Mount WebDAV as drive in Windows 8 - Server Fault -
This is a concise summary of the steps required to allow Windows to connect to a WebDAV share using HTTP "basic" authentication.
Found the Solution: Basic auth.

Change BasicAuthLevel to 2 under HKLM\SYSTEM\CurrentControlSet\Services\WebClient\Parameters

Then restart WebClient service:

net stop WebClient
net start WebClient
My Apache2 config for those interested:

NameVirtualHost *
<VirtualHost *>
ServerAdmin webmaster@localhost

DocumentRoot /var/www/webdav/mounts
<Directory /var/www/webdav/mounts>
Options Indexes MultiViews
AllowOverride None
Order allow,deny
allow from all

Alias /webdav /var/www/webdav/mounts

<Location /webdav>
AuthType Basic
AuthName "webdav"
AuthUserFile /var/www/webdav/passwd.dav
Require valid-user

windows  sysadmin  apache  webdav  basicauth  security  authentication  solution  registryhack 
february 2016 by kme
webdav - How do I enable HTTP-DAV in Apache? - Server Fault
This actually didn't describe my problem, but a problem I could see myself making in the future. What was actually my problem was that I tried to guess at the "module identifier," thinking it was just "mod_something" without the "mod_". Nope.

You either need to find the *exact* .so filename (e.g., '', which is found in /usr/lib/apache2/modules on Debian), or look in the Apache docs for 'mod_whatever'. For WebDAV, the module identifier is "dav_module".
apache  webdav  webmaster  configfile  annoyance  dammitbrain  solution 
february 2016 by kme
« earlier      
per page:    204080120160

Copy this bookmark:

to read