-
Notifications
You must be signed in to change notification settings - Fork 0
Installation Instructions (Nginx)
AtomicBlog can be installed and run in a variety of environments. These instructions assume a Debian or Ubuntu based Linux distribution. I've used Debian 13 to test and devise the following instructions.
The necessary dependencies can be installed with the following shell command.
sudo apt-get install nginx php-fpm php-mysql mariadb-server git
Firstly, enter the MySQL shell with the following command. If you happen to be logged in as root, you may omit the sudo in this and all commands in this tutorial.
sudo mysql
Create a MySQL user for the software to use to interact with the database. Replace username with your username of choice, and replace password with a strong password.
CREATE USER 'username'@'localhost' IDENTIFIED BY 'password';
Create a database for the software to use.
CREATE DATABASE AtomicBlog;
Give the user all permissions within the AtomicBlog database only.
GRANT ALL PRIVILEGES ON AtomicBlog.* TO 'username'@'localhost';
Exit the MySQL shell.
exit;
Finally, run the following terminal command and enter "y" to everything unless it tells you that you can safely enter "n". If the command doesn't work, skip this step.
sudo mysql_secure_installation
These instructions are for the most basic possible Nginx setup. That is, no domain name, no SSL certificates, no HTTPS. Just a basic HTTP server that serves the AtomicBlog application.
Navigate to the WWW (world wide web) directory.
cd /var/www
Create a directory for AtomicBlog.
sudo mkdir atomic
Enter the Nginx site configuration directory.
cd /etc/nginx/sites-available
Create a copy of the default configuration, naming it atomic.
sudo cp default atomic
Edit the configuration file.
sudo nano atomic
Replace root /var/www/html; with root /var/www/atomic;. Add index.php to the index list. Change server_name _ to server_name localhost or whatever your domain is if you have one. Uncomment the lines beneath the pass PHP scripts to FastCGI server line. Leave the fastcgi_pass 127.0.0.1:9000; line commented out. Replace the fast_cgi_pass unix:/run/php/php7.4-fpm.sock; line with fastcgi_pass unix:/run/php/php-fpm.sock;. If you want to specify your exact php version, you can run sudo cat /run/php to see what it's named and then do that. If you only plan on having one version of PHP installed, then using php-fpm.sock is recommended.
Also, inside of the location / {} block, comment out the existing content and add this:
try_files $uri $uri/ /index.php?$args;
Note that this mod rewrite rule is broken on local installs of the software. Allegedly this works on more standard public webservers so I'm leaving it here until a later date. For now, I can't test it so prettyURLs may just not work on Nginx.
Enable the site.
sudo ln -s /etc/nginx/sites-available/atomic /etc/nginx/sites-enabled/
Disable the default site.
sudo rm /etc/nginx/sites-enabled/default
Test the configuration, this will tell you if there are any errors.
sudo nginx -t
Restart Nginx so the changes take effect.
sudo systemctl restart nginx
Go into the AtomicBlog directory.
cd /var/www/atomic
Download AtomicBlog using git.
sudo git clone https://github.com/rainier39/AtomicBlog
Move all of the files up into the current directory.
sudo mv AtomicBlog/* ./
Remove the AtomicBlog folder, it just contains some github related files that aren't needed for a production server.
sudo rm -rf AtomicBlog
Make the core and images directories readable and writable for all users.
sudo chmod 777 core images
With this setup, root will own every file, and only the core and images directories will be writable to other users so that AtomicBlog can install and upload images, and manage the config.
Assuming you're on the same machine as AtomicBlog has been set up on, open your browser and navigate to localhost. You should see the AtomicBlog installer. Fill out the install form as desired, ensuring to use the MySQL user and database you created earlier in this guide. The SQL server will be localhost. After this, your blog should be installed and everything should be working smoothly.
If you want your URLs to look like http://localhost/posts instead of http://localhost/index.php?url=posts you will have to manually edit the config file. Simply change prettyURLs from false to true. This doesn't work in localhost test environments but may work on traditional public environments. I haven't tested it so it's quite possible prettyURLs don't work on Nginx for now and will only be available on Apache2.