Please do ask if you need any more information. I'm just trying to work out what is going on. So I have a server with nginx as the front end, and then passing along to Apache (2.4.18). In my Apache config file for the domain I have:
<VirtualHost *:8181>
CustomLog /home/steampunkcom/web/uk.site.com/logs/uk.site.com.apache.log combined
ErrorLog /home/steampunkcom/web/uk.site.com/logs/uk.site.com.apache.error.log
LogLevel error
RemoteIPHeader X-Forwarded-For
# MOD_PERL
LoadModule perl_module /usr/lib/apache2/modules/mod_perl.so
ServerName uk.site.com
ServerAlias www.uk.site.com
ServerAdmin info@uk.site.com
DocumentRoot /home/steampunkcom/web/uk.site.com/public_html
# MOD_PERL
PerlRequire /home/steampunkcom/web/uk.site.com/startup.pl
ScriptAlias /cgi-bin/ /home/steampunkcom/web/uk.site.com/public_html/cgi-bin/
Alias /vstats/ /home/steampunkcom/web/uk.site.com/stats/
Alias /error/ /home/steampunkcom/web/uk.site.com/document_errors/
# Uncomment this part to make run as mod_perl - comment out above as well!
<Directory "/home/steampunkcom/web/uk.site.com/*">
Options +ExecCGI +FollowSymLinks +MultiViews
AllowOverride AuthConfig
PerlResponseHandler ModPerl::Registry
AddHandler perl-script .cgi .pl
Options +ExecCGI
PerlOptions +ParseHeaders
AllowOverride All
Require all granted
</Directory>
<Directory /home/steampunkcom/web/uk.site.com/stats>
AllowOverride All
Require all granted
</Directory>
<IfModule mod_ruid2.c>
RMode config
RUidGid steampunkcom steampunkcom
RGroups www-data
</IfModule>
<IfModule itk.c>
AssignUserID steampunkcom steampunkcom
</IfModule>
IncludeOptional /home/steampunkcom/conf/web/apache2.uk.site.com.conf*
</VirtualHost>
This works fine. It runs under mod_perl well. The issue arises when I try and enable mod_perl on another user account:
<VirtualHost *:8181>
CustomLog /home/willr/web/anothersite.co.uk/logs/anothersite.co.uk.apache.log combined
ErrorLog /home/willr/web/anothersite.co.uk/logs/anothersite.co.uk.apache.error.log
LogLevel error
RemoteIPHeader X-Forwarded-For
LoadModule perl_module /usr/lib/apache2/modules/mod_perl.so
PerlRequire /home/willr/web/anothersite.co.uk/startup.pl
ServerName anothersite.co.uk
ServerAlias www.anothersite.co.uk
ServerAdmin info@anothersite.co.uk
DocumentRoot /home/willr/web/anothersite.co.uk/public_html
#####
ScriptAlias /cgi-bin/ /home/willr/web/anothersite.co.uk/public_html/cgi-bin/
#####
Alias /vstats/ /home/willr/web/anothersite.co.uk/stats/
Alias /error/ /home/willr/web/anothersite.co.uk/document_errors/
<Directory "/home/willr/web/anothersite.co.uk/*">
Options +ExecCGI +FollowSymLinks +MultiViews
AllowOverride AuthConfig
PerlResponseHandler ModPerl::Registry
AddHandler perl-script .cgi .pl
Options +ExecCGI
PerlOptions +ParseHeaders
AllowOverride All
Require all granted
</Directory>
<IfModule mod_ruid2.c>
RMode config
RUidGid willr willr
RGroups www-data
</IfModule>
<IfModule itk.c>
AssignUserID willr willr
</IfModule>
</VirtualHost>
At first I thought it was all working fine, but then I started getting emails from people telling me they couldn't log into the site. Upon looking into it, I found that it was sharing a module across the user accounts. I'm trying to figure out why, and what I can do about it. I know for a fact mod_perl can run across multiple user accounts without sharing the modules (as I've done it on other servers that were managed for me), but I'm not sure how/ why its doing it here.
Any ideas are much appreciated! In the meantime I've had to disable mod_perl for one of the sites, as it was causing too many issues for the other site :(
I just found something about using the +Parent
and PerlSwitches
config:
<VirtualHost ...>
ServerName dev1
PerlOptions +Parent
PerlSwitches -I/home/dev1/lib/perl
</VirtualHost>
https://perl.apache.org/docs/2.0/user/config/config.html#C_Parent_
The problem though is that it still seems to cause the modules to get "shared" across other user accounts. So I have:
PerlOptions +ParseHeaders +Parent
PerlSwitches -Mlib=/home/steampunkcom/web/foo.co.uk/lib
When I look at the contents of @INC, I can see:
@INC =
/home/steampunkcom/web/foo.com/public_html/cgi-bin/admin
/home/steampunkcom/web/foo.com/lib
/etc/perl
/usr/local/lib/x86_64-linux-gnu/perl/5.22.1
/usr/local/share/perl/5.22.1
/usr/lib/x86_64-linux-gnu/perl5/5.22
/usr/share/perl5
/usr/lib/x86_64-linux-gnu/perl/5.22
/usr/share/perl/5.22
/usr/local/lib/site_perl
.
/etc/apache2
I really thought I had a solution there, but maybe not :(