pkg install php83
pkg install php83-session
Note! If you miss the latter session install, your code will appear
to need a 'global' decl for subroutines to get at the $_SESSION
variable. What's really happening, is that the session var is not
actually present, so you're creating a var yourself, and it's NOT a
"super-global". I really, really, really hate PHP.
I got Apache running with the default installation. I then brought
over all the config files for Apache, corrected the ServerName, and
tried starting. No startup, and a core file. I went back to the
default installation file, and painstakingly merged a few lines at a
time from the old httpd.conf
. I eventually determined
the line that was breaking everything was the include of PHP. PHP is
installed, as v 8.3.0alpha2. I'm pretty sure I've done a pkg
install mod_php8
-- do it again, yes it's already installed.
Doing a find / -name libphp.so -print
yields files
in /usr/local/lib/
and /usr/local/libexec/apache24/
directories -- looks
good.
In desperation, I tried rebooting -- fixed it!
Google search found this nice article: FAMP stack FreeBSD
/usr/local/etc/apache/httpd.conf
and ensure the following:LoadModule libexec/apache24/mod_mime.so
. This
should already be present, however it might need to be
un-commented-out.mpm_prefork_module
followed by
an IfModule
which loads cgi_module
. I do
not know if this is necessary, I'm just guessing here.<IfModule mime_module>
section, add the line:AddType application/perl .pl
AddHandler cgi-script .cgi .pl
<IfModule dir_module>
section, you may wish to
add index.pl
to the list. Note this assumes you've done
a LoadModule
of dir_module
earlier.<Directory />
decl, which must have:Options ExecCGI
, it can have other decls if you wish.AllowOverride All
Require all granted
.htaccess
file in the actual
webpage/script direct that can override these settings.mkdir /var/run/ssl_mutex
755 root wheel
.
(Note -- I know, this is a poorly organized page -- be sure to step down through it, as what you're looking for may be buried down near the end.)
Setup Apache by following the handbook at
http://www.apache.org/docs/install.html.
SSLVerifyClient require
to none
in
you ssl config section."http-ssl.conf
file. ("/web/vintners.net/logs/httpd-ssl_request_log2018q1" on my server).apachectl start
- real helpful!/var/log/http-error.log
I see the error:Init:Session Cache is not configured
http.conf
I've tried each:LoadModule socache_shmcb_module libexec/apache24/mod_socache_shmcb.so
LoadModule socache_dbm_module libexec/apache24/mod_socache_dbm.so
Include/http-ssl.conf
enable the line:SSLSessionCache "dbm:/var/run/ssl_scache"
accf_http_load="YES"
/boot/loader.conf
accf_data_load="YES"
/usr/local/etc/apache/httpd.conf
file.man pw
for help with this.)chmod 600
chown root
UserDir
directive to html
as the default
is public_html
.Directory
directive for /home/*/public_html
-- be sure to
change that too if you're commetning it in to use.SSLEngine
on
, and SSLCertificateFile
/usr/local/etc/apache/ssl.crt/your-cert-file.crt
. Be sure
to 'chmod' this dir appropriately (see above).apache-restart
script
and get used to using it instead of directly using
apachectl
:
/usr/local/sbin/apachectl stop /usr/local/sbin/apachectl startsslThe reason is that if you do an "apachectl restart", it will not restart modssl. I can't tell you how many times I forgot this...
apache.sh
file in /usr/local/etc/rc.d/
. See
my Autostart hints page for more
info./usr/local/bin
. If it's not there, you will need to
make a symbolic link in that dir to your existing Perl installation.
If you don't have Perl at all, you'll need to get it. This was not a
problem in a modern install (FreeBSD 4.2, Apache 1.3.)My basic Apache1.3 installation seemed to have mostly worked the first time. The standard FreeBSD modus operandi worked well:
cd /usr/ports/www/apache13
make
su
make install
When I wrote this doc originally (FreeBSD was at 3.2? at that time), VeriSign cost $349 for the first website for the first year. Thawte is $125 for the exact same thing. As far as I can tell, there are no other reason to choose one over the other. Which one do you think I used? Since then, Thawte has been bought out by Verisign, or Network Solutions or some such, which legitimizes it even further!
Warning! If you have an existing Apache installation, I
would recommend doing a make deinstall
as superuser
before beginning this part. I do not know if it is necessary, but at
some point I did find I had several files out of synch, and ended up
having to do an 'rm -r', 'cvsup', and start over.
cd /usr/ports/www/apache13-modssl
make
make install
make certificate
cd /usr/local/openssl
cp openssl.cnf.sample openssl.cnf
cd /usr/ports/www/apache13-modssl/work/apache_1.3.9/src
cp Configuration.tmpl Configuration
cd ..
make install
cd /usr/ports/security/rsaref
make
make install
cd /usr/ports/security/openssl
make USA_RESIDENT=YES
make install
cd /usr/ports/devel/mm
make
make install
cd /usr/ports/www/apache13-modssl
make |& tee make.log
make certificate
make install
Now this year, I had to update it. I got an email from Thawte with about 1 month notice. I went to their website (URL in their email), and did the "renewal" option. I first tried the non-"real-time" option. This refused several different credit cards. Then I tried the "real-time" flavor, that worked. It sent me an email with a URL where to get my new certificate, which I visited, then did a file save, naming it a .txt.
(Basically, this is your new .crt file.) I cut out all the junk,
leaving the "----begin ..." and end lines, and saved it as mycert.crt.
I was able to view it by:
openssl x509 -noout -text -in mycert.crt | more
The original key you used to establish the certificate will be used again for this new one.
Enter your passphrase and don't forget it!
Now create an unencoded version of it:
mv mycert.key ../ssl.key
cp mycert.key mycert.key.orig
openssl rsa -in mycert.key.orig -out mycert.key
I was then able to simply point the SSLCertificateFile
and SSLCertificateKeyFile
directive in the
/usr/local/etc/apache/httpd.conf
file to these new
files.
Don't forget to chmod/chown
these files so that
they can only be read by the apache user account, whatever you're
using (see below).
Thawte has a logo and magic URL that will verify your certificate for the user. I highly recommend adding this to your secure pages, or at least the entry page to the secure environment -- see their website for details.
VirtualHost block
Now you must add a new virtualhost block to the config file. You'll
have one of these for your own domain, and an additional for each
additional domain.
<VirtualHost this machines IP addr> ServerAdmin webmaster@domain Options Indexes FollowSymLinks ExecCGI Includes DocumentRoot /web/domain/html/ ServerName domain ServerAlias *.domain ErrorLog /web/domain/logs/error_log CustomLog /web/domain/logs/access_log common </VirtualHost>
[28/Jan/2001 14:50:25 00411] [warn] Init: (brix.vintners.net:443) RSA server certificate CommonName (CN) `secure.vintners.net' does NOT match server name!?Then do an
apachectl stop
and apachectl
startssl
. Be warned that apachectl start
does
start the Apache server, but does not start the SSL portion
-- incoming HTTP requests will be processed, but incoming HTTPS
requests will time out. This can be very disconcerting if you don't
know about it.
Now use ps ax | grep httpd
to see if it's running. If
so, skip on to browser certificate test (below).
If not running, best of luck! One important thing to note is that the
SSL related errors will be in the file pointed to by the
SSLLog
directive (default is
/var/log/ssl_engine_log
).
To test it, in Netscape, visit the server (using https://... note
that's https
, not
just http
), and click on the little padlock icon on
the bottom left corner. Then click on the "View Certificate" button
and check that the new parms show up.
AuthName "whomever's private dir" AuthType Basic AuthUserFile /usr/local/etc/apache/users require valid-user
htpasswd
to create the pseudo user with passwdI've tried using suidperl and got that F***ing "fix your kernel" message. Eventually gave up on that and went with the crude C wrapper for my script. (Of course this is after manually chmod'ing suidperl to allow setuid since the perl install doesn't, even when you make it with the switches to use suidperl...)
For example, I have a script that allows customers to modify the email
aliases for their domain. This is a simple Perl script running via
mod_perl or CGI to edit one or more of the following files:
/etc/virtusertable
/etc/aliases.customer
The difficult part is that sendmail will refuse to run if any of these
files is not owned by root.
The way I got around this is to add the user under which apache runs ("www") to the "wheel" entry in /etc/group. I'm sure this is a vile security hole, but it got things such that my customers can manage their own accounts.