Skip to content

Instantly share code, notes, and snippets.

@fsans
Last active April 13, 2021 17:08
Show Gist options
  • Save fsans/970c45e53ceb2c457444e9aae483cb20 to your computer and use it in GitHub Desktop.
Save fsans/970c45e53ceb2c457444e9aae483cb20 to your computer and use it in GitHub Desktop.
Configure FMServer httpd to custom directory

Checked in FSM v19.2

This is the FM Server home... ( FMSERVER_ROOT )

/Library/FileMaker\ Server

This is the FM Server cwp root... ( FM_CWP_ROOT )

/Library/FileMaker\ Server/HTTPServer

(Notice the escaped space... or enclose paths between single quotes)

Create a custom dir. Add a minimal html page, give it to fmsadmin group and owned by fmserver privileges...

sudo mkdir /Library/FileMaker\ Server/Data/Documents/custom

sudo echo '<!DOCTYPE html><p>Hello World</p>' > index.html

chown -R fmserver /Library/FileMaker\ Server/Data/Documents/custom
chgrp -R fmsadmin /Library/FileMaker\ Server/Data/Documents/custom
chmod -R u+r+w+x,g+r+w+x,o+r+w+x /Library/FileMaker\ Server/Data/Documents/custom

BACKUP THE ORIGINAL APACHE CONF FILE...

sudo cp /Library/FileMaker\ Server/HTTPServer/conf/httpd.conf /Library/FileMaker\ Server/HTTPServer/conf/httpd.conf.back

Append the following lines at the end... (copy and paste ALL of the following bloc in a terminal window and execute hit RETURN)

sudo cat '
# include custom configuration
Include conf/custom.conf
# end custom config
' >> /Library/FileMaker\ Server/HTTPServer/conf/httpd.conf

Create and Edit the custom config file...

(copy and paste ALL of the following bloc in a terminal window and hit RETURN)

sudo echo '#
# custom directory to fmserver data
# Do not espape spaces in paths inside apache conf file, just quote it !
#
Alias /custom "/Library/FileMaker Server/Data/Documents/custom"
<Directory "/Library/FileMaker Server/Data/Documents/custom">
    AllowOverride none
    Options Indexes FollowSymLinks MultiViews
    Require all granted
</Directory>
#
# end custom config
#' > ~/Desktop/custom.conf


open an verify that the contect is OK, as...

# custom directory to fmserver data
# Do not espape spaces in paths inside apache conf file, just quote it !
#
Alias /custom "/Library/FileMaker Server/Data/Documents/custom"
<Directory "/Library/FileMaker Server/Data/Documents/custom">
    AllowOverride none
    Options Indexes FollowSymLinks MultiViews
    Require all granted
</Directory>
#
# end custom config
#

notes:

Usually you'll remove all options in production mode, so chage this line...

...
Options Indexes FollowSymLinks MultiViews
...

to...

...
Options none
...

give some privileges and move the file to httpd config folder...

chown -R fmserver ~/Desktop/custom.conf
chgrp -R fmsadmin ~/Desktop/custom.conf
chmod -R u+r+w+x,g+r+w+x,o+r+w+x ~/Desktop/custom.conf

sudo mv ~/Desktop/custom.conf /Library/FileMaker\ Server/HTTPServer/conf/custom.conf

Restart FMServer httpd service (no FMServer restart required... usually)

cd /Library/FileMaker\ Server/HTTPServer/bin
sudo ./httpdctl restart

or

cd /Library/FileMaker\ Server/HTTPServer/bin
sudo ./httpdctl stop
sudo ./httpdctl start

test the new config here...

http.//localhost/custom/index.html

if something went wrong... get the basic first aid before calling me back...

sudo launchctl stop com.filemaker.fms
sudo launchctl start com.filemaker.fms

and retry...

http.//localhost/custom/index.html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment