Apache multiple domains, MySQL, WordPress

posted in: Nezařazené | 0
0
(0)

Original Link

Install Apache webserver

sudo apt-get install apache2

Make directory structure for two domains, change ownership and making webs directories accesible

sudo mkdir -p /var/www/domain1.com
sudo mkdir -p /var/www/domain2.com

sudo chown -R $USER:$USER /var/www/domain1.com
sudo chown -R $USER:$USER /var/www/domain2.com

sudo chmod -R 755 /var/www

Create the virtual hosts configuration files for two sites

<VirtualHost *:80>
ServerAdmin webmaster@localhost        
ServerName alarmynakolo.cz
        ServerAlias www.domain1.com
        DocumentRoot /var/www/domain1.com
	ErrorLog ${APACHE_LOG_DIR}/error.log
	CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
<VirtualHost *:80>
	ServerAdmin webmaster@localhost
	ServerName domain2.com
	ServerAlias www.domain2.com
	DocumentRoot /var/www/domain2.com
	ErrorLog ${APACHE_LOG_DIR}/error.log
	CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

Enable seite configurations

sudo a2ensite domain1.com.conf
sudo a2ensite domain2.com.conf
systemctl reload apache2

Install WordPress (Link)

sudo apt update && sudo apt upgrade
//mariadb
sudo apt install mariadb-server mariadb-client

//mySQL
https://www.digitalocean.com/community/tutorials/how-to-install-mysql-on-ubuntu-20-04
sudo apt install mysql-server
sudo systemctl start mysql.service
sudo mysql
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'password';

sudo mysql_secure_installation    (change root password)
apt install php php-mysql

Database

mysql -u root -p
CREATE DATABASE wp_domain1_com;
CREATE DATABASE wp_domain2_com;
CREATE USER 'WordPressUser'@'localhost' IDENTIFIED BY 'YouRSecPASSword123';
GRANT ALL ON wp_domain1_com.* TO 'WordPressUser'@'localhost'
GRANT ALL ON wp_domain2_com.* TO 'WordPressUser'@'localhost'
FLUSH PRIVILEGES;
exit

//restore database from dump .sql file
mysql -u root -p wp_domain1_com < /home/klokan/Desktop/_dbs/domain1.sql

//phpMyAdmin
sudo apt install phpmyadmin php-mbstring php-zip php-gd php-json php-curl
sudo phpenmod mbstring
systemctl reload apache2

sudo systemctl restart mysql
sudo snap install mysql-workbench-community
snap connect mysql-workbench-community:password-manager-service
snap connect mysql-workbench-community:ssh-keys
snap connect mysql-workbench-community:cups-control
snap connect mysql-workbench-community:removable-media
sudo apt install dbus-x11

sudo mysql-workbench-community

Additional settings

Support for image editing in wordpress media
https://linux.how2shout.com/how-to-install-php-imagemagick-on-ubuntu-22-04/

Did you like this post?

Click on a star to rate it!

Average rating 0 / 5. Vote count: 0

No votes so far! Be the first to rate this post.

Follow jiri_klokocka:

Latest posts from