Install Foswiki with Nginx on Ubuntu 24.04
You install Foswiki with Nginx on Ubuntu 24.04 by setting up Nginx as a reverse proxy and web server to handle requests for the Foswiki application.
Foswiki is a powerful, open-source wiki engine built on Perl, designed for collaborative content creation and knowledge management. Itās perfect for building internal wikis or project documentation sites.
This setup on Ubuntu 24.04 LTS ensures your Foswiki instance runs efficiently and securely. Nginx, a high-performance web server, will manage the incoming traffic.
Install Foswiki on Ubuntu 24.04 by installing Nginx and Perl, downloading and extracting Foswiki to the web serverās root directory, and then configuring Nginx to serve the application. Ensure correct file permissions and run provided scripts for setup.
Install Nginx HTTP server on Ubuntu
Youāll need a web server to run Foswiki, and installing Nginx on your Ubuntu 24.04 system is a great first step.
To do that, open your Ubuntu terminal and run the commands below to install the Nginx web server.
sudo apt update
sudo apt install nginx
After installing Nginx, you can use the commands below to start, stop, and enable it to launch automatically when your server starts.
sudo systemctl stop nginx
sudo systemctl start nginx
sudo systemctl enable nginx
You can test the Nginx web server by opening your web browser and browsing to your serverās localhost or IP address.
When you see theĀ Welcome to nginx!Ā message, it means the Nginx HTTP server is successfully installed.
You can find additional help installing Nginx on Ubuntu in the link below.
Install Perl and Related Modules
Foswiki uses Perl, so we need to install it and some important Perl modules on your Ubuntu system before we can proceed.
sudo apt-get install rcs libalgorithm-diff-perl libarchive-tar-perl libauthen-sasl-perl libcgi-pm-perl libcgi-session-perl libcrypt-passwdmd5-perl libdigest-sha-perl libemail-address-xs-perl libemail-mime-perl libencode-perl liberror-perl libfile-copy-recursive-perl libhtml-parser-perl libhtml-tree-perl libio-socket-ip-perl libio-socket-ssl-perl libjson-perl liblocale-codes-perl liblocale-maketext-perl liblocale-maketext-lexicon-perl liblocale-msgfmt-perl libwww-perl liblwp-protocol-https-perl liburi-perl libversion-perl libfcgi-perl libfcgi-procmanager-perl fcgiwrap spawn-fcgi libfcgi-perl
Download Foswiki files
Now, letās get the Foswiki software downloaded and ready to go on your Ubuntu machine.
To always install the latest version, check theĀ download page for Foswiki. Get the download link, download the archived package to your computer, and then extract it.
First, navigate to theĀ /tmp/Ā directory and download theĀ FoswikiĀ files. Then, extract the content into theĀ FoswikiĀ folder within the Nginx root directory.
Finally, youāll change file permissions. This lets the Nginx web server interact securely with your Foswiki files, keeping your installation safe.
Next, run the commands below to set the correct permissions for the Nginx root folder so the Foswiki application can work properly.
cd /tmp
wget https://github.com/foswiki/distro/releases/download/FoswikiRelease02x01x09/Foswiki-2.1.9.zip
unzip Foswiki-*.zip
sudo cp -rf Foswiki-2.1.9 /var/www/foswiki
sudo chown -R www-data:www-data /var/www/foswiki/
If the file permissions have been modified for any reason, the shell scriptĀ tools/fix_file_permissions.shĀ can repair the installation.
cd /var/www/foswiki
sudo -u www-data sh tools/fix_file_permissions.sh
Next, run the script below to fix the bin scripts and ensure everything is set up correctly.
cd /var/www/foswiki/tools
sudo -u www-data perl rewriteshebang.pl
When prompted, select āyā to apply your changes.
Next, copy these files from the Foswiki tools folder to the `/etc/` directory by running the commands below.
sudo cp /var/www/foswiki/tools/foswiki.defaults /etc/default/foswiki
sudo cp /var/www/foswiki/tools/foswiki.init-script /etc/init.d/foswiki
Then, change the permissions and reload the services.
sudo chmod 755 /etc/init.d/foswiki
sudo service foswiki start
Once you have completed all the above steps, continue configuring the Nginx web server below to serve theĀ FoswikiĀ content.
Run the commands below to create a Nginx virtual host file forĀ Foswiki.
sudo nano /etc/nginx/sites-available/foswiki.conf
Then, copy and paste the content block below into the Nginx server block.
server {
listen 80;
server_name foswiki.example.com;
set $foswiki_root "/var/www/foswiki";
root $foswiki_root;
location / {
root $foswiki_root;
rewrite ^/?$ http://foswiki.example.com/bin/view.pl/Main permanent;
}
location /bin/configure {
allow 127.0.0.1;
fastcgi_pass unix:/var/run/fcgiwrap.socket;
fastcgi_split_path_info ^/foswiki(/bin/configure)(?:.pl)?(.*);
fastcgi_param SCRIPT_FILENAME $foswiki_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
include fastcgi_params;
}
location /bin/ {
fastcgi_pass unix:/var/run/fcgiwrap.socket;
fastcgi_split_path_info ^(/bin/w+)(.*);
fastcgi_param SCRIPT_FILENAME $foswiki_root/$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
include fastcgi_params;
}
}
Save the file.
Then, run the commands below to enable the virtual host and restart the Nginx server.
sudo ln -s /etc/nginx/sites-available/foswiki.conf /etc/nginx/sites-enabled/
sudo systemctl restart nginx.service
Setup Letās Encrypt SSL/TLS for Foswiki
Itās a good idea to secure your Foswiki site with a free Letās Encrypt SSL/TLS certificate, especially since weāre using Nginx on Ubuntu.
Please read the post below for additional resources on installing and creating Letās Encrypt SSL certificates for Nginx.
How to set up Letās Encrypt SSL certificate for Nginx on Ubuntu Linux
Once you have restarted the Nginx web server, open your browser and browse to the server hostname or IP address you defined in the Nginx server block.
http://foswiki.example.com/bin/view
TheĀ FoswikiĀ setup wizard should appear.
Click on the configure link to set up the app.

Begin configuring all the necessary settings for your site. Click the Save button in the upper right corner of the configuration page.
The login section at the top of the left-hand menu should show that you are still logged in as a temporary Admin user. Click on the āLog Outā link to exit that user.

You have now set up your Foswiki installation! At this point, you can start creating and editing pages.

Foswiki should be ready to use.
Conclusion:
Installing Foswiki with Nginx support on Ubuntu 24.04 provides a robust collaboration environment. Here are the key takeaways:
- Foswiki Overview: A powerful open-source platform for collaborative content management.
- Nginx Benefits: Efficient handling of high traffic with minimal resource usage.
- Installation Process: Involves installing Nginx, Perl modules, and Foswiki files.
- Configuration Steps: Setting up Nginx virtual hosts to serve Foswiki effectively.
- Security Measures: Implementing SSL/TLS with Letās Encrypt for secure access.
- User-Friendly Setup: The setup wizard guides you through the final configuration steps.
With these steps completed, you can now leverage the full potential of Foswiki for your teamās collaborative needs.
Can nginx run on Ubuntu?
Nginx is available in Ubuntuās default repositories. You can install it using the apt packaging system. First, update your local package index to access the most recent package listings, then install nginx: sudo apt update.
Was this guide helpful?
About the Author
Richard
Tech Writer, IT Professional
Richard, a writer for Geek Rewind, is a tech enthusiast who loves breaking down complex IT topics into simple, easy-to-understand ideas. With years of hands-on experience in system administration and enterprise IT operations, heās developed a knack for offering practical tips and solutions. Richard aims to make technology more accessible and actionable. He's deeply committed to the Geek Rewind community, always ready to answer questions and engage in discussions.
@members ai slop
Remote Reply
Original Comment URL
Your Profile
Why do I need to enter my profile?
This site is part of the ā open social web, a network of interconnected social platforms (like Mastodon, Pixelfed, Friendica, and others). Unlike centralized social media, your account lives on a platform of your choice, and you can interact with people across different platforms.
By entering your profile, we can send you to your account where you can complete this action.