I am using Apache2 and ubuntu. Before my attempt to install wordpress on my server, i was able to open my domain in browser. But after the commands that i wrote below, i can not open it. When i browse my domain it is giving 403 error
Forbidden You don't have permission to access this resource.
I used the commands below while i was installing wordpress. And now, i am wondering how to fix this situation. And which files or other things should i check. Thank you.
First Commands That I Used For In My Terminal
wget http://wordpress.org/latest.tar.gz
tar -xzvf latest.tar.gz
mysql -u root -p
CREATE DATABASE wordpress; Query OK, 1 row affected (0.00 sec)
CREATE USER wordpressuser@localhost; Query OK, 0 rows affected (0.00 sec)
SET PASSWORD FOR wordpressuser@localhost= PASSWORD("password"); Query OK, 0 rows affected (0.00 sec)
GRANT ALL PRIVILEGES ON wordpress.* TO wordpressuser@localhost IDENTIFIED BY 'password'; Query OK, 0 rows affected (0.00 sec)
FLUSH PRIVILEGES; Query OK, 0 rows affected (0.00 sec)
cp ~/wordpress/wp-config-sample.php ~/wordpress/wp-config.php
sudo nano ~/wordpress/wp-config.php
// ** MySQL settings - You can get this info from your web host ** // /** The name of the database for WordPress */ define('DB_NAME', 'wordpress'); /** MySQL database username */ define('DB_USER', 'wordpressuser'); /** MySQL database password */ define('DB_PASSWORD', 'password');
sudo rsync -avP ~/wordpress/ /var/www/
cd /var/www/
sudo chown username:www-data /var/www -R sudo chmod g w /var/www -R
sudo apt-get install php5-gd
As These Commands Above Didnt Work for me I used Other Commands Below After Deleting Wordpress Directory
cd /var/www/html
sudo wget https://wordpress.org/latest.tar.gz
sudo tar xvfz latest.tar.gz
sudo chown www-data.www-data wordpress/
Those Commands Also Didnt Work For Me So I Added The Other Ones Below
sudo mkdir -p /var/www/html/example.com/src/
cd /var/www/html/example.com/src/
chmod 755 /var/www/html
chmod 750 /var/www
sudo chown -R www-data:www-data /var/www/html/example.com/
sudo wget http://wordpress.org/latest.tar.gz
sudo -u www-data tar -xvf latest.tar.gz
sudo mv latest.tar.gz wordpress-`date " %Y-%m-%d"`.tar.gz
sudo mkdir /var/www/html/example.com/public_html/
sudo mv wordpress/* ../public_html/
sudo chown -R www-data:www-data /var/www/html/example.com/public_html
CodePudding user response:
I replicated your steps on Ubuntu 20.04.3 LTS and it works fine. Here are my steps.
sudo su
apt install apache2
apt install mysql-server
wget http://wordpress.org/latest.tar.gz
tar -xzvf latest.tar.gz
rsync -avP ./wordpress/ /var/www/html
cd /var/www/html
rm index.html
apt install php-mysql
mysql
mysql> CREATE DATABASE wordpress;
mysql> CREATE USER wordpressuser@localhost;
mysql> ALTER USER wordpressuser@localhost IDENTIFIED BY 'pass';
mysql> GRANT ALL PRIVILEGES ON wordpress.* TO wordpressuser@localhost ;
mysql> FLUSH PRIVILEGES;
systemctl restart apache2
If it doesn't work please paste your /var/log/apache2/error.log
, your os-release and output of php -v
.
CodePudding user response:
apache2 error.log
os release and p -v output