Apache2 not pointing to the WordPress directory - wordpress

First I followed this tutorial:
https://www.tecmint.com/install-wordpress-alongside-lamp-on-debian-10/
Which worked fine until I got to the step where I needed to set the permissions. After that, when I try to cd wordpress I get Permission Denied, so I had to sudo su to continue following the directions.
Then in step 6 where you set the DocumentRoot, I followed that to the latter.
Now on step 7, where you actually test if you can access the WordPress initial installation screens, Apache2 is still displaying the Default apache2 static page.
I found this tutorial as well:
https://dade2.net/how-to-install-lamp-wordpress-ubuntu-and-debian/
While that second one is more recent, the only difference is that it uses slightly different Permissions and uses MariaDB. So I tried their Permissions and can now cd into wordpress without sudo su.
But the apache2 static page is still there.
Has something changed with Apache2 or WordPress that's preventing it from pointing to WP?

Looks like your are trying to install apache2 with WordPress. I would suggest you to follow these steps and let me know, if it helps.
$ sudo apt-get update
Install apache
$ sudo apt install apache2
Verify your Apache installation by typing "http://your-ip-address" in your favourite browser.
hostname -I | awk '{print $1}' # can help you to get your IP address.
If you have firewall installed run this command to enable port 80. If you don't have firewall, skip this step.
$ sudo ufw allow 'Apache'
Install wordpress
1. sudo apt update
2. sudo apt install wordpress php libapache2-mod-php mysql-server php-mysql
3. cd /etc/apache2/sites-available/
4. sudo vi wordpress.conf
#Add these lines in wordpress.conf
Alias /blog /usr/share/wordpress
<Directory /usr/share/wordpress>
Options FollowSymLinks
AllowOverride Limit Options FileInfo
DirectoryIndex index.php
Order allow,deny
Allow from all
</Directory>
<Directory /usr/share/wordpress/wp-content>
Options FollowSymLinks
Order allow,deny
Allow from all
</Directory>
5. sudo a2ensite wordpress
6. sudo a2enmod rewrite
7. sudo service apache2 reload
Now Configure mysql
$ sudo mysql -u root
Once you get mysql prompt, Run create, grant, Flush and quit command as follows -
$ mysql> CREATE DATABASE wordpress;
set username and password
$ mysql> create user 'wordpress'#'localhost' IDENTIFIED BY 'test1234';
Run these commands
mysql> GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,DROP,ALTER ON wordpress.* TO 'wordpress'#'localhost';
mysql> FLUSH PRIVILEGES;
mysql> quit
Now, configure "/etc/wordpress/config-localhost.php file to link MySQL DB "WordPress" created above. create the config-localhost.php, if doesn't exist.
add these lines
<?php
define('DB_NAME', 'wordpress');
define('DB_USER', 'wordpress');
define('DB_PASSWORD', 'test1234');
define('DB_HOST', 'localhost');
define('DB_COLLATE', 'utf8_general_ci');
define('WP_CONTENT_DIR', '/usr/share/wordpress/wp-content');
?>
Restart mysql service
$ sudo service mysql start
Login to your WordPress by opening "localhost/blog/wp-login.php".
I found this link, may be helpful for you. It shows each step screenshot also.

Related

Disable webserver write access wordpress-Digital Ocean

I have used the following commands in Putty to ENABLE rewrite, so I can update wordpress in my LAMP stack Wordpress install.
$sudo a2enmod rewrite
$sudo chown -R www-data /var/www
I would like to disable rewrite so no one can install plugins and update wordpress automatically from wordpress admin area. What command should I use to do so?

Does bitnami wordpress stack allow multiple wordpress installs

I am currently using the bitnami wordpress stack, I have a website I'm working on but I also want to start another but I don't want to use multisite because I don't want them to share a database.
so is it possible to install another WordPress on bitnami? if yes how do i go about it?
Bitnami Engineer here,
You can deploy another application on top of a running Bitnami instance by following these steps. They assume that your application will live in the /opt/bitnami/apps/myapp/ directory:
Run the following commands to create the directories and assign the necessary permissions:
sudo mkdir /opt/bitnami/apps/myapp
sudo mkdir /opt/bitnami/apps/myapp/htdocs/
sudo mkdir /opt/bitnami/apps/myapp/conf
sudo chown -R bitnami:daemon /opt/bitnami/apps/myapp/htdocs/
sudo chmod -R g+w /opt/bitnami/apps/myapp/htdocs/
Create and edit the /opt/bitnami/apps/myapp/conf/httpd-prefix.conf file and add the line below to it:
Alias /myapp/ "/opt/bitnami/apps/myapp/htdocs/"
Alias /myapp "/opt/bitnami/apps/myapp/htdocs/"
Include "/opt/bitnami/apps/myapp/conf/httpd-app.conf"
Create and edit the /opt/bitnami/apps/myapp/conf/httpd-app.conf file and add the content below to it. This is the main configuration file for your application, so modify it further depending on your application’s requirements.
<Directory /opt/bitnami/apps/myapp/htdocs/>
Options +FollowSymLinks
AllowOverride None
<IfVersion < 2.3 >
Order allow,deny
Allow from all
</IfVersion>
<IfVersion >= 2.3>
Require all granted
</IfVersion>
</Directory>
NOTE: If your application uses .htaccess files, you should change the AllowOverride None option to AllowOverride All. Find out how to move the .htaccess file content to the main server configuration file.
Once you have created the files and directories above, add the following line to the end of the main Apache configuration file at /opt/bitnami/apache2/conf/bitnami/bitnami-apps-prefix.conf, as shown below:
Include "/opt/bitnami/apps/myapp/conf/httpd-prefix.conf"
Restart the Apache server:
sudo /opt/bitnami/ctlscript.sh restart apache
You should now be able to access the application at http://SERVER-IP/myapp.
Note: As WordPress requires a database, you will need to create a new database in the server
You can find more information about how to deploy a custom application in this guide of our documentation
https://docs.bitnami.com/general/apps/wordpress/administration/create-custom-application-php/
Thanks

How do I create a FTP user in Amazon Lightsail to update Wordpress Plugins

I successfully migrated a Wordpress site from BlueHost to AWS Lightsail. When I go to update the plugins, Wordpress is asking for FTP credentials (see the image).
By default, you can only connect to the Lightsail instance via SSH Certificate, which I have successfully done via Transit.
In your lightsail firewall rules make sure you allow access to TCP ports 21 and 1024-1048 from 127.0.0.1
SSH to your Lightsail instance (use putty for windows unless you know how to edit files with vim)
run the following commands to install vsftpd.
sudo apt install vsftpd
sudo nano /etc/vsftpd.conf
uncomment these lines:
local_enable=YES
write_enable=YES
add these lines:
pasv_enable=YES
pasv_min_port=1024
pasv_max_port=1048
pasv_address=127.0.0.1
Press Ctrl+X , Y , ENTER to save the changes to the file (this is why I said to use putty)
run this command to see what group owns the wp-content directory
ls -l /home/bitnami/apps/wordpress/htdocs/
In my lightsail instance, it was the "daemon" group
Note:other articles suggest adding this user to the bitnami group, but in my experience this resulted in errors during update siting that it was not able to create directories.
Run the following to create a new user and assign it to this group so that it will have access to write to the wp-content directory.
(in the following lines, substitute ftpuser for the new username)
sudo /etc/init.d/vsftpd restart
sudo adduser ftpuser
sudo usermod -d /home/bitnami ftpuser
sudo usermod -a -G daemon ftpuser
sudo /etc/init.d/vsftpd restart
Now you can try your updates again and it should work.
use 127.0.0.1 for the hostname and specify the new FTPuser credentials you just created.

Running XAMPP on Mac with other user not working

I'm currently having a problem with XAMPP and WordPress on my Mac. I've downloaded the latest XAMPP version and installed it on my Mac.
After moving WordPress into the htdocs folder, I've got an error in the Dashboard because of missing write permissions.
After searching for some minutes, I've tried to give everyone access to the htdocs folder via the Finder. But that don't helped. So I've tried this here:
https://www.zigpress.com/2018/03/19/resolving-permissions-issues-in-xampp-on-mac-high-sierra/
So I've entered my local Mac user name (johnnymarten, found out via whoami) and the group staff. The problem is, that the Apache Server don't starts anymore now and I'm getting this error message here:
INFO: Starting "apache"
ERROR: Failed to start "apache": cannot start
service: AH00543: httpd: bad user name johnnymarten
I'm coming from Windows and I don't get this done. I'm at lease done with this. Do you have any idea what I can do?
Xampp runs as root. Reset file permissions to get it to start.
1) reset directory: sudo chown -R root:admin /Applications/XAMPP
2) on my Xampp 2 directories are different:
sudo chown -R daemon:daemon /Applications/XAMPP/xamppfiles/logs
sudo chown -R daemon:daemon /Applications/XAMPP/xamppfiles/temp
3) Make a new directory for WordPress and let everyone use it.
mkdir new_dir
chmod 777 new_dir
4) Add directory to httpd.conf
<Directory "/new_dir">
Options ExecCGI FollowSymLinks
AllowOverride All
Require all granted
RewriteEngine On
RewriteBase /
</Directory>
Load WP in /new_dir
Restart Apache.

How to give bitnami user edit permission on .htaccess for bitnami multisite ec2?

I have installed a Bitnami Multisite Wordpress AMI on my Amazon EC2 instance. to setup the Multiite Network I need to make changes in the .htaccess file.
I checked the permission on the file :
-rw-r--r-- 1 daemon daemon 235 Nov 29 12:15 .htaccess
I need the bitnami user to be able to edit the file. So first I did
getfacl .htaccess
# file: .htaccess
# owner: daemon
# group: daemon
user::rw-
group::r--
other::r--
I am logged in as bitnami user. So i used the command as below to give bitnami edit permissions.
sudo setfacl –m u:bitnami:rwx .htaccess
But I get the error as
Usage: setfacl [-bkndRLP] { -m|-M|-x|-X ... } file ...
Try `setfacl --help' for more information.
Need help to resolve the same.
Thanks
Bitnami Engineer here.
You can change the permissions of the .htaccess file by running this command
sudo chown bitnami:daemon .htaccess
sudo chmod g+w .htaccess
After running those commands, you can start to edit the file.
For security and performance reasons, we do not allow Apache to read the .htaccess files. For this reason, we moved the configuration in the .htaccess files to the main application configuration files and set the AllowOverride option to None by default.
You have two different options to start using .htaccess files:
- Edit the /opt/bitnami/apps/mediawiki/conf/htaccess.conf file and include the information of the .htaccess file inside a Directory block. You will find more information about this in this guide
https://docs.bitnami.com/aws/apps/wordpress-multisite/administration/use-htaccess/
Edit the /opt/bitnami/apps/wordpress/conf/httpd-app.conf file and change the AllowOverride option to All. After that, you will need to restart Apache
In both options, you will need to restart Apache after that:
sudo /opt/bitnami/ctlscript.sh restart apache

Resources