I'm trying to run an Apache 2.0 server on my desktop PC, and I'm wondering how I can use MySQL or another service to run a personal website. What way can I run the server on my domain using this method?
Any help would be appreciated. Thanks.
Apache 2.0 web hosting on a personal desktop
Forum rules
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
- madelinesaxen
- Level 1
- Posts: 5
- Joined: Fri Jun 02, 2023 3:01 am
- Location: Texas, United States
Apache 2.0 web hosting on a personal desktop
Last edited by LockBot on Sun Dec 03, 2023 11:00 pm, edited 1 time in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
- Maddie
Re: Apache 2.0 web hosting on a personal desktop
Hello madelinesaxen.
Could you please post the specs of your desktop where you want to run the server?
I run a small Mint "server" at home with Nexcloud in it. I can give you a few pointers/recommendations/opinions.
If that is your main computer, IMO it is a good idea to containerize the server and keep it separate from your stuff as you will be exposing it to the world.
You could use a virtual machine for example and run the web server from there. This will allow you to play with it and revert back if you mess up anything using snapshots while not affecting your main system at all.
Consider your network / internet speed. specially your Upload speed. If the site is meant to be visited by the occasional family member and friend it should be fine, but as you get some traffic and depending on what you are planning to host (pictures/videos?), you can bring your network to a crawl.
Do you have a static IP?... using a dynamic IP that frequently changes will require extra steps to setup the domain.
Remember to keep the server always up to date, and use a firewall on your main system just in case.
To setup the Apache server and SQL, look for LAMP and follow an updated tutorial.
If i were a beginner, i would use wordpress. And read/watch a few tutorials on setting up stuff with Docker. Here is a script you can use with Docker to setup the whole thing in one shot:
You just need to change the names and passwords in there and you will be set.
Learn how to manage docker containers, or just take the snapshots in the VM before setting this up,
Otherwise use any cheap web hosting, or setup your own EC2 cloud server with Amazon, it is free the first year (look for their t3.micro).
Good luck with the site!
Could you please post the specs of your desktop where you want to run the server?
Code: Select all
inxi -Fzxx
If that is your main computer, IMO it is a good idea to containerize the server and keep it separate from your stuff as you will be exposing it to the world.
You could use a virtual machine for example and run the web server from there. This will allow you to play with it and revert back if you mess up anything using snapshots while not affecting your main system at all.
Consider your network / internet speed. specially your Upload speed. If the site is meant to be visited by the occasional family member and friend it should be fine, but as you get some traffic and depending on what you are planning to host (pictures/videos?), you can bring your network to a crawl.
Do you have a static IP?... using a dynamic IP that frequently changes will require extra steps to setup the domain.
Remember to keep the server always up to date, and use a firewall on your main system just in case.
To setup the Apache server and SQL, look for LAMP and follow an updated tutorial.
If i were a beginner, i would use wordpress. And read/watch a few tutorials on setting up stuff with Docker. Here is a script you can use with Docker to setup the whole thing in one shot:
Code: Select all
sudo docker run -d \
-e MYSQL_DATABASE=mydb \
-e MYSQL_USER=myuser \
-e MYSQL_PASSWORD=mypassword \
-e MYSQL_ROOT_PASSWORD=rootpassword \
--name mymysql \
mysql:latest
sudo docker run -d \
-e WORDPRESS_DB_HOST=mymysql \
-e WORDPRESS_DB_NAME=mydb \
-e WORDPRESS_DB_USER=myuser \
-e WORDPRESS_DB_PASSWORD=mypassword \
--name mywordpress \
--link mymysql:mysql \
-p 80:80 \
wordpress:latest
Learn how to manage docker containers, or just take the snapshots in the VM before setting this up,
Otherwise use any cheap web hosting, or setup your own EC2 cloud server with Amazon, it is free the first year (look for their t3.micro).
Good luck with the site!
Linux Mint Una Cinnamon 20.3 Kernel: 5.15.x | Quad Core I7 4.2Ghz | 24GB Ram | 1TB NVMe | Intel Graphics
- madelinesaxen
- Level 1
- Posts: 5
- Joined: Fri Jun 02, 2023 3:01 am
- Location: Texas, United States
Re: Apache 2.0 web hosting on a personal desktop
I have started the Docker mySQL database, and it had finished successfully, though I don't think I need wordpress becase I have used HTML5 before, though I am rusty. I setup the server on a separate drive and ZFS partition and user for security purposes.
Is there other steps can I take to set it up?
Here are the specs of my computer:
I am running it as a server for only a few occasional people to visit, and I don't need many resources to run it. I have a high speed router and ISP connection so it should run well for my needs.Consider your network / internet speed. specially your Upload speed. If the site is meant to be visited by the occasional family member and friend it should be fine, but as you get some traffic and depending on what you are planning to host (pictures/videos?), you can bring your network to a crawl.
Is there other steps can I take to set it up?
Here are the specs of my computer:
Code: Select all
System:
Kernel: 5.15.0-56-generic x86_64 bits: 64 compiler: gcc v: 11.3.0
Desktop: Cinnamon 5.6.8 tk: GTK 3.24.33 wm: muffin dm: LightDM
Distro: Linux Mint 21.1 Vera base: Ubuntu 22.04 jammy
Machine:
Type: Desktop Mobo: Gigabyte model: B550I AORUS PRO AX v: x.x
serial: <superuser required> UEFI: American Megatrends LLC. v: F15
date: 01/04/2022
CPU:
Info: 8-core model: AMD Ryzen 7 3700X bits: 64 type: MT MCP arch: Zen 2
rev: 0 cache: L1: 512 KiB L2: 4 MiB L3: 32 MiB
Speed (MHz): avg: 3192 high: 3205 min/max: 2200/3934 boost: enabled
cores: 1: 3180 2: 3194 3: 3193 4: 3192 5: 3193 6: 3193 7: 3191 8: 3194
9: 3194 10: 3193 11: 3191 12: 3205 13: 3194 14: 3193 15: 3192 16: 3192
bogomips: 102208
Flags: avx avx2 ht lm nx pae sse sse2 sse3 sse4_1 sse4_2 sse4a ssse3 svm
Graphics:
Device-1: NVIDIA TU116 [GeForce GTX 1660 Ti] vendor: ASUSTeK
driver: nouveau v: kernel pcie: speed: 2.5 GT/s lanes: 16 ports:
active: DP-1 empty: DP-2,HDMI-A-1,HDMI-A-2 bus-ID: 0b:00.0
chip-ID: 10de:2182
Device-2: Logitech Webcam C270 type: USB driver: snd-usb-audio,uvcvideo
bus-ID: 5-1:2 chip-ID: 046d:0825
Display: x11 server: X.Org v: 1.21.1.4 driver: X: loaded: modesetting
unloaded: fbdev,vesa gpu: nouveau display-ID: :1 screens: 1
Screen-1: 0 s-res: 1920x1080 s-dpi: 96
Monitor-1: DP-1 model: AOC 24G1WG4 res: 1920x1080 dpi: 94
diag: 598mm (23.5")
OpenGL: renderer: llvmpipe (LLVM 15.0.6 256 bits) v: 4.5 Mesa 22.2.5
direct render: Yes
Audio:
Device-1: NVIDIA TU116 High Definition Audio vendor: ASUSTeK
driver: snd_hda_intel v: kernel pcie: speed: 2.5 GT/s lanes: 16
bus-ID: 0b:00.1 chip-ID: 10de:1aeb
Device-2: AMD Starship/Matisse HD Audio vendor: Gigabyte
driver: snd_hda_intel v: kernel pcie: speed: 16 GT/s lanes: 16
bus-ID: 0d:00.4 chip-ID: 1022:1487
Device-3: Corsair HS80 RGB Wireless Gaming Receiver type: USB
driver: hid-generic,snd-usb-audio,usbhid bus-ID: 1-5:7 chip-ID: 1b1c:0a73
Device-4: Logitech Webcam C270 type: USB driver: snd-usb-audio,uvcvideo
bus-ID: 5-1:2 chip-ID: 046d:0825
Sound Server-1: ALSA v: k5.15.0-56-generic running: yes
Sound Server-2: PulseAudio v: 15.99.1 running: yes
Sound Server-3: PipeWire v: 0.3.48 running: yes
Network:
Device-1: Realtek RTL8125 2.5GbE vendor: Gigabyte driver: r8169 v: kernel
pcie: speed: 5 GT/s lanes: 1 port: f000 bus-ID: 09:00.0 chip-ID: 10ec:8125
IF: eno1 state: down mac: <filter>
Device-2: MEDIATEK driver: mt7921e v: kernel pcie: speed: 5 GT/s lanes: 1
port: N/A bus-ID: 0a:00.0 chip-ID: 14c3:0608
IF: wlp10s0 state: up mac: <filter>
IF-ID-1: docker0 state: down mac: <filter>
Bluetooth:
Device-1: MediaTek Wireless_Device type: USB driver: btusb v: 0.8
bus-ID: 1-8:5 chip-ID: 0e8d:0608
Report: hciconfig ID: hci0 rfk-id: 0 state: up address: <filter>
bt-v: 3.0 lmp-v: 5.2 sub-v: 2202
RAID:
Device-1: bpool type: zfs status: ONLINE level: linear raw: size: 1.88 GiB
free: 1.61 GiB zfs-fs: size: 1.75 GiB free: 1.48 GiB
Components: Online: N/A
Device-2: rpool type: zfs status: ONLINE level: linear raw: size: 920 GiB
free: 895 GiB zfs-fs: size: 891.5 GiB free: 866.35 GiB
Components: Online: N/A
Device-3: zserver type: zfs status: ONLINE level: linear raw:
size: 476 GiB free: 476 GiB zfs-fs: size: 461.25 GiB free: 461.25 GiB
Components: Online: 1:
Drives:
Local Storage: total: raw: 1.43 TiB usable: 3.22 TiB used: 47.02 GiB (1.4%)
ID-1: /dev/nvme0n1 vendor: Western Digital model: WD BLACK SN770 1TB
size: 931.51 GiB speed: 63.2 Gb/s lanes: 4 serial: <filter> temp: 54.9 C
ID-2: /dev/nvme1n1 vendor: Intel model: SSDPEKNW512G8 size: 476.94 GiB
speed: 31.6 Gb/s lanes: 4 serial: <filter> temp: 44.9 C
ID-3: /dev/sda type: USB vendor: Generic model: N/A size: 58 GiB
serial: <filter>
Partition:
ID-1: / size: 887.43 GiB used: 21.08 GiB (2.4%) fs: zfs
logical: rpool/ROOT/ubuntu_2yhufy
ID-2: /boot size: 1.75 GiB used: 270.8 MiB (15.1%) fs: zfs
logical: bpool/BOOT/ubuntu_2yhufy
ID-3: /boot/efi size: 512 MiB used: 15.9 MiB (3.1%) fs: vfat
dev: /dev/nvme0n1p2
ID-4: /var/log size: 866.37 GiB used: 18 MiB (0.0%) fs: zfs
logical: rpool/ROOT/ubuntu_2yhufy/var/log
Swap:
ID-1: swap-1 type: partition size: 2 GiB used: 0 KiB (0.0%) priority: -2
dev: /dev/dm-1 mapped: cryptoswap
Sensors:
System Temperatures: cpu: 46.0 C mobo: 45.0 C gpu: nouveau temp: 32.0 C
Fan Speeds (RPM): N/A gpu: nouveau fan: 1040
Info:
Processes: 731 Uptime: 1d 16h 32m Memory: 31.25 GiB used: 20.21 GiB (64.7%)
Init: systemd v: 249 runlevel: 5 Compilers: gcc: 11.3.0 alt: 11/12
clang: 14.0.0-1ubuntu1 Packages: 2485 apt: 2481 snap: 4 Shell: Bash
v: 5.1.16 running-in: gnome-terminal inxi: 3.3.13
- Maddie
Re: Apache 2.0 web hosting on a personal desktop
Nevermind about docker... it will be too messy for a beginner. I did some tests today in a VM trying to set up this, you may stop the container and purge it from the system.madelinesaxen wrote: ⤴Sat Jun 03, 2023 5:04 pm I have started the Docker mySQL database, and it had finished successfully,
Here is a script that will set your system with apache, php, mysql and phpadmin: (AGAIN, i suggest you do this in a VM, but you can do it in your main mint 21 system if you want)
Replace (
your_password_here
) with a secure password for the database.If you dont know how to run a script:
Copy the code in a text file to your desktop and save it as myscript.sh
Right click the text file, go to the permissions tab and tick the "Allow executing file as a program" checkbox. Close
Now right click in an empty space on your desktop and click "open in terminal". so you will launch a terminal inside the Desktop folder.
Type
./myscript.sh
(it starts with he period) and hit enter.Code: Select all
#!/bin/bash
# Update your system APT
sudo apt update
# Install Apache2
sudo apt install apache2 -y
# Install PHP
sudo apt install -y php libapache2-mod-php php-mysql
# setup MySQL (set your PASSWORD in the line below)
password="your_password_here"
sudo debconf-set-selections <<< "mysql-server mysql-server/root_password password $password"
sudo debconf-set-selections <<< "mysql-server mysql-server/root_password_again password $password"
sudo apt install -y mysql-server
# Install phpMyAdmin
sudo debconf-set-selections <<< "phpmyadmin phpmyadmin/dbconfig-install boolean true"
sudo debconf-set-selections <<< "phpmyadmin phpmyadmin/app-password-confirm password $password"
sudo debconf-set-selections <<< "phpmyadmin phpmyadmin/mysql/admin-pass password $password"
sudo debconf-set-selections <<< "phpmyadmin phpmyadmin/mysql/app-pass password $password"
sudo debconf-set-selections <<< "phpmyadmin phpmyadmin/reconfigure-webserver multiselect apache2"
sudo apt install -y phpmyadmin
# Enable needed apache modules
sudo a2enmod php
sudo phpenmod mbstring
# Restart apache
sudo systemctl restart apache2
# start MySQL
sudo systemctl start mysql
localhost
to access the website, or http://localhost/phpmyadmin
to open the mysql admin panel.User is root, password whatever you set up in the script.
It will work.
Then your next step will be pointing your domain to your IP address. Open port 80 and 443 on your router and forward it to the server.
Then look for "certbot" instructions. Install it and get free SSL for your website once everything is running.
Your root folder for the pages is in
/var/www/html
You will need to use php and sql coding if you want to do anything with the website and database. HTML5 alone will not be enough
This is the bare bones... you should secure the server, use the firewall.
Good luck
Linux Mint Una Cinnamon 20.3 Kernel: 5.15.x | Quad Core I7 4.2Ghz | 24GB Ram | 1TB NVMe | Intel Graphics