Testing setting up freebsd web server - Hsanokklis/2023-2024-Tech-journal GitHub Wiki
everywhere that is says museadmin.my.id will be web.stitch.local
Links used:
https://www.howtoforge.com/how-to-install-freebsd-120-on-zfs/
Install Wordpress on Freebsd: https://musaamin.web.id/install-wordpress-with-apache-lets-encrypt-ssl-on-freebsd/
How to Install Apache, MySQL, PHP and PHPMyAdmin on FreeBSD: https://www.zenarmor.com/docs/freebsd-tutorials/how-to-install-apache-mysql-php-and-phpmyadmin-on-freebsd#:~:text=You%20may%20easily%20install%20FAMP,Install%20PHP
Add user to the wheel group: https://www.cyberciti.biz/faq/howto-freebsd-add-a-user-to-wheel-group/
Install vs Live CD
- Live CD is like a sample, you test it out before you actually do it and make changes to your hard drive.
fbsd-stitch
password: lilo-stitch
pkg install apache24
sysrc apache24_enable="YES"
service apache24 start
add stitch user to the wheel group
In order to ssh to the computer via my windows terminal I had to make the stitch user a root user since I could not ssh with the root account.
pw group mod wheel -m stitch
Run http://10.0.1.206
to test if the Apache web server is running
Create a folder for the document root
mkdir -p /var/www/museadmin.my.id
echo "hello world" > /var/www/museadmin.my.id/index.html
Create a folder to store virtual host configuration files
mkdir /usr/local/etc/apache24/vhosts
Create a folder for Apache logs
mkdir /var/log/apache
Install nano via
pkg install nano
Create a virtual host configuration file.
nano /usr/local/etc/apache24/vhosts/museadmin.my.id.conf
Fill in the virtual hosts configuration file.
<VirtualHost *:80>
DocumentRoot /var/www/museadmin.my.id
ServerName _
# ServerAlias www.museadmin.my.id
ErrorLog /var/log/apache/museadmin.my.id_error.log
CustomLog /var/log/apache/museadmin.my.id_access.log common
<Directory /var/www/musaamin.my.id>
Order allow,deny
Allow from all
Require all granted
AllowOverride All
</Directory>
</VirtualHost>
museadmin.my.id
will change to web.stitch.local
Open the Apache configuration file
nano /usr/local/etc/apache24/httpd.conf
Enable the ServerName
option and enter the server IP address.
-
ServerName 10.0.1.206
(this will be configured with a static IP)
Add include vhosts at the bottom of configuration file
Include etc/apache24/vhosts/*.conf
Check for configuration errors
apachectl -t
- if there is no mistake it will say
Syntax OK
Restart Apache
service apache24 restart
Browse http://museadmin.my.id it will be http://web.stitch.local
in the real one
pkg install mysql80-server
sysrc mysql_enable="YES"
service mysql-server start
-
service mysql-server status
- if it works, it should be say
mysql is running ____
- if it works, it should be say
mysql_secure_installation
mysql -u root -p
-
pkg install php82 mod_php82 php82-mysqli php82-mbstring php82-pecl-mcrypt php82-zlib php74-curl php82-opcache php82-xml php82-gd php82-zip
-
nano /usr/local/etc/apache24/Includes/php.conf
-
Fill in the conf file with the code below --->
<IfModule dir_module>
DirectoryIndex index.php index.html
<FilesMatch "\.php$">
SetHandler application/x-httpd-php
</FilesMatch>
<FilesMatch "\.phps$">
SetHandler application/x-httpd-php-source
</FilesMatch>
</IfModule>
-
touch php.ini
-
cp /usr/local/etc/php.ini-production /usr/local/etc/php.ini-production.default
-
ln -s /usr/local/etc/php.ini-production /usr/local/etc/php.ini
-
service apache24 restart
-
touch info.php
-
echo "<?php phpinfo(); ?>" > /var/www/museadamin.my.id/info.php
Make sure this works at http://museadmin.my.id/info.php
pkg install mariadb105-server mariadb105-client
Activate and run the MariaDB service
sysrc mysql_enable="YES"
service mysql-server start
mysql_secure_installation
Login to MariaDB
-
mysql -u root -p
(set the password during mysql_secure_installation)
CREATE DATABASE musaamin;
CREATE USER 'musaamin'@localhost IDENTIFIED BY 'rahasia';
GRANT ALL PRIVILEGES ON musaamin.* TO 'musaamin'@'localhost';
FLUSH PRIVILEGES;
exit
IDENTIFIED BY means the password
pkg wget install
wget https://wordpress.org/latest.tar.gz -O wordpress.tar.gz
tar xzvf wordpress.tar.gz
Copy the contents of the wordpress folder to the document root
- `cp -Rfv wordpress/* /var/www/museadmin.my.id
Change ownership
chown -R www:www /var/www/museadmin.my.id
Delete the index.html and info.php files created earlier
rm -f /var/www/musaamin.my.id/info.php
rm -f /var/www/musaamin.my.id/index.html
Browse to http://musaamin.my.id to install WordPress
- Continue
- Let's Go!
- Enter the credentials made in MariaDB:
- database name
- username
- password
- Database Host = 127.0.0.1 (submit)
- Run the installation
- Enter the site title, password, and email ---> Install WordPress
- Browse https://museadmin.my.id and login to the dashboard
Go into root with su -l
mysql -u root -p
to specify that it needs a password.
pkg install wget
pkg install nano
Installing PHP stuff