Create virtualhost inside user directory ubuntu 22.04

I am a backend developer from Indonesia, focused on php, and some cloud platform administrator
Search for a command to run...

I am a backend developer from Indonesia, focused on php, and some cloud platform administrator
No comments yet. Be the first to comment.
AWS 3-Tier Architecture is an excellent choice for developers who aim to run their systems efficiently while minimizing costs. This architecture is structured into three distinct layers: the Presentation Tier, the Application Tier, and the Database T...
Pendahuluan Pada artikel ini kalian akan belajar tentang bagaimana build extensi PHP dengan menggunakan make, yang mana tools tersebut membantu dalam me-build PHP Library dari source code sehingga lebih fleksible digunakan pada berbagai versi php dal...
Modify User Model first things you must to do is use libray or something to provide uuid, you can use ramsey/uuid or use from laravel facades Illuminate\Database\Eloquent\Concerns\HasUuids. namespace App\Containers\AppSection\User\Models; use Illumi...

Hi everyone today i want to show you how to make filter search name by combine first name and last name in database field using laravel repository with implement request criteria refer to this l5-repository. Database Scheme first we have a database w...

Sometimes when you try to deploy your front-end frameworks like vue.js or react.js, your web server cannot refresh your page after you login into that page. Here are some configurations in your web server configuration if you are using NGINX : locati...
In this article i will show you how to create virtual host for your domain or sub domain as far as i know, watch step below.
like commonly type this sudo apt update && sudo upgrade -y
type this to install apache2 sudo apt install apache2.
Check your apache2 status with this syntax sudo systemctl status apache2 and you will see this.

you can create new user for that or existing user, you can set 1 user for 1 domain it will make easy for setup.
type this sudo adduser exampleuser, it will create new user folder in this location /home/exampleuser. then you can check you user with this command less /etc/passwd or cut -d: -f1 /etc/passwd.
add exampleuser to Apache www-data group sudo usermod -a -G www-data exampleuser. and add that user to sudo group with this sudo usermod -a -G sudo exampleuser. then you can verify that user successfull to add group groups exampleuser. you can see list of member www-data so type grep ^www-data /etc/group.
prepare your application folder, make sure you create public_html folder inside your user directory, type this mkdir public_html make sure your directory like this /home/exampleuser/public_html.
go to /etc/apache2/sites-available then create conf file using vim vim exampleuser.conf here conf code:
#exampleuser.conf
<VirtualHost *:80>
ServerAdmin admin@domain.io
ServerName exampleuser.com #your domain
ServerAlias www.exampleuser.com #server alias
DocumentRoot /home/arif/public_html #your path project
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /home/exampleuser/public_html>
AllowOverride All
</Directory>
ErrorLog ${APACHE_LOG_DIR}/exampleuser-error.log
CustomLog ${APACHE_LOG_DIR}/exampleuser-access.log combined
</VirtualHost>
then you can check your syntax with sudo apachectl config test
enable your config file sudo a2ensite exampleuser.conf.
enable userdir sudo a2enmod userdir.
enable mod rewrite sudo a2enmod rewrite.
then adding firewall sudo ufw allow "Apache full".
restart your apache sudo systemctl reload apache2.