luisserrano
Posts: 28
Joined: Mon Nov 27, 2017 4:49 pm

More than one Wordpress in my Raspberry Pi

Fri Jul 20, 2018 9:57 am

Hi all.

I have a working Wordpress installation with no problems in my Raspberry Pi, but now I need to install another standalone Wordpress site (no multisite). The main Wordpress site is in /var/www/html and I have created a subfolder inside HTML folder (/html/wordpress2/). I placed all new Wordpress installation files inside there (using console commands and sudo) and changed ownership and permissions recursively for all those files. Same owner and permissions used in the first Wordpress and Working site.

Now, when I visit .../html/wordpress2/ to start the Wordpress installation but I receive a 403 code from server, No permission to access.

I changed all those folders and files to the correct ownership and permissions, like I did in my first Wordpress site so... whats the problem? apache? .htaccess?. Im a bit lost now.

Any help or clue will be welcome.
Thanks in advance.
Regards.

OO-Dragon
Posts: 7
Joined: Sat Jun 02, 2018 3:09 pm

Re: More than one Wordpress in my Raspberry Pi

Sat Jul 21, 2018 3:23 am

Try running this first, just to make sure its not a file permission issue.

sudo chmod 777 /var/www/html/wordpress2 -R

If it works after that, it is a permission issue, and might just be a type for the user or group name.

** Sorry, forgot to add sudo **

luisserrano
Posts: 28
Joined: Mon Nov 27, 2017 4:49 pm

Re: More than one Wordpress in my Raspberry Pi

Sat Jul 21, 2018 7:35 am

Hey Dragon, thanks for your answer.

Still 403 after a recursive 777

: (

OO-Dragon
Posts: 7
Joined: Sat Jun 02, 2018 3:09 pm

Re: More than one Wordpress in my Raspberry Pi

Sun Jul 22, 2018 3:25 am

I'll need more info. Can you post a screenshot of you getting the error? (Whole page, so I can see error, address bar, etc) Also if you can post your web server config. What web server are you using?

User avatar
rpdom
Posts: 12654
Joined: Sun May 06, 2012 5:17 am
Location: Ankh-Morpork

Re: More than one Wordpress in my Raspberry Pi

Sun Jul 22, 2018 5:59 am

Is there any useful information in your Apache log files? /var/log/apache2/error.log often has something in it.

luisserrano
Posts: 28
Joined: Mon Nov 27, 2017 4:49 pm

Re: More than one Wordpress in my Raspberry Pi

Sun Jul 22, 2018 8:41 am

Hi again.

Sorry, I need to resolve a bigger problem after upgrade to Stretch. I will retake this thread as soon I fix this:

viewtopic.php?f=36&t=218675

I hope to get back here soon.

Thanks.

luisserrano
Posts: 28
Joined: Mon Nov 27, 2017 4:49 pm

Re: More than one Wordpress in my Raspberry Pi

Fri Jul 27, 2018 6:21 pm

Some kind of error in this forum is bumping this post, Im triying to edit it right now

luisserrano
Posts: 28
Joined: Mon Nov 27, 2017 4:49 pm

Re: More than one Wordpress in my Raspberry Pi

Fri Jul 27, 2018 6:29 pm

Impossible to post here... corrupt attatchment files, bugy editing... sorry

I have to attatch only 1 screenshot per post, sorry.
Last edited by luisserrano on Fri Jul 27, 2018 6:32 pm, edited 1 time in total.

luisserrano
Posts: 28
Joined: Mon Nov 27, 2017 4:49 pm

Re: More than one Wordpress in my Raspberry Pi

Fri Jul 27, 2018 6:31 pm

Well, Im back and got some screenshots

Here the requested capture from browser. No more than a 403. (All files and folder has a recursive 777)
The attachment wp_403.JPG is no longer available
Attachments
wp_403.JPG
wp_403.JPG (43.56 KiB) Viewed 366 times

luisserrano
Posts: 28
Joined: Mon Nov 27, 2017 4:49 pm

Re: More than one Wordpress in my Raspberry Pi

Fri Jul 27, 2018 6:31 pm

A single PHP file working inside /wordpress2 with no problems
php_ok.JPG
php_ok.JPG (36.47 KiB) Viewed 366 times

luisserrano
Posts: 28
Joined: Mon Nov 27, 2017 4:49 pm

Re: More than one Wordpress in my Raspberry Pi

Fri Jul 27, 2018 6:32 pm

The apache2 error.log with no related errors, I guess...
The attachment apache2_error_log.JPG is no longer available
Still no way to get more than 1 wordpress in this raspbian.
Attachments
apache2_error_log.JPG
apache2_error_log.JPG (43.3 KiB) Viewed 366 times

User avatar
DougieLawson
Posts: 33348
Joined: Sun Jun 16, 2013 11:19 pm
Location: Basingstoke, UK
Contact: Website

Re: More than one Wordpress in my Raspberry Pi

Fri Jul 27, 2018 6:48 pm

What's the ownership of ../wordpress2 & ../wordpress2/wp-admin? Can www-data read ../wordpress2/wp-admin/setup-config.php? [Note: Those file names are relative to your document root as defined in your Apache2 configuration.]
Microprocessor, Raspberry Pi & Arduino Hacker
Mainframe database troubleshooter
MQTT Evangelist
Twitter: @DougieLawson

2012-18: 1B*5, 2B*2, B+, A+, Z, ZW, 3Bs*3, 3B+

Any DMs sent on Twitter will be answered next month.

luisserrano
Posts: 28
Joined: Mon Nov 27, 2017 4:49 pm

Re: More than one Wordpress in my Raspberry Pi

Sat Jul 28, 2018 4:30 pm

DougieLawson wrote:
Fri Jul 27, 2018 6:48 pm
What's the ownership of ../wordpress2 & ../wordpress2/wp-admin? Can www-data read ../wordpress2/wp-admin/setup-config.php? [Note: Those file names are relative to your document root as defined in your Apache2 configuration.]
Every file file and folder inside wordpress2 belong to www-data (user and group). Setup-config.php was on 644, neither with 777!!

Maybe .htaccess? Im lost here. Thanks for help.

User avatar
DougieLawson
Posts: 33348
Joined: Sun Jun 16, 2013 11:19 pm
Location: Basingstoke, UK
Contact: Website

Re: More than one Wordpress in my Raspberry Pi

Sat Jul 28, 2018 6:01 pm

What's in your config files for apache2 (specifically in your <directory>...</directory> directives for WP & WP2).
Microprocessor, Raspberry Pi & Arduino Hacker
Mainframe database troubleshooter
MQTT Evangelist
Twitter: @DougieLawson

2012-18: 1B*5, 2B*2, B+, A+, Z, ZW, 3Bs*3, 3B+

Any DMs sent on Twitter will be answered next month.

luisserrano
Posts: 28
Joined: Mon Nov 27, 2017 4:49 pm

Re: More than one Wordpress in my Raspberry Pi

Mon Jul 30, 2018 5:11 am

DougieLawson wrote:
Sat Jul 28, 2018 6:01 pm
What's in your config files for apache2 (specifically in your <directory>...</directory> directives for WP & WP2).

Here is my apache2 config file. Never edited manually. I Cant stop thinking about a possible lack or mistake in .htaccess

# Global configuration
#ServerRoot "/etc/apache2"

# The accept serialization lock file MUST BE STORED ON A LOCAL DISK.
Mutex file:${APACHE_LOCK_DIR} default

# PidFile: The file in which the server should record its process
# identification number when it starts.
# This needs to be set in /etc/apache2/envvars
PidFile ${APACHE_PID_FILE}

# Timeout: The number of seconds before receives and sends time out.
Timeout 300

# KeepAlive: Whether or not to allow persistent connections (more than
# one request per connection). Set to "Off" to deactivate.
KeepAlive On

# MaxKeepAliveRequests: The maximum number of requests to allow
# during a persistent connection. Set to 0 to allow an unlimited amount.
# We recommend you leave this number high, for maximum performance.
MaxKeepAliveRequests 100

# KeepAliveTimeout: Number of seconds to wait for the next request from the
# same client on the same connection.
KeepAliveTimeout 5


# These need to be set in /etc/apache2/envvars
User ${APACHE_RUN_USER}
Group ${APACHE_RUN_GROUP}

# HostnameLookups: Log the names of clients or just their IP addresses
# e.g., www.apache.org (on) or 204.62.129.132 (off).
# The default is off because it'd be overall better for the net if people
# had to knowingly turn this feature on, since enabling it means that
# each client request will result in AT LEAST one lookup request to the
# nameserver.
HostnameLookups Off

# ErrorLog: The location of the error log file.
# If you do not specify an ErrorLog directive within a <VirtualHost>
# container, error messages relating to that virtual host will be
# logged here. If you *do* define an error logfile for a <VirtualHost>
# container, that host's errors will be logged there and not here.
ErrorLog ${APACHE_LOG_DIR}/error.log

# LogLevel: Control the severity of messages logged to the error_log.
# Available values: trace8, ..., trace1, debug, info, notice, warn,
# error, crit, alert, emerg.
# It is also possible to configure the log level for particular modules, e.g.
# "LogLevel info ssl:warn"
LogLevel warn

# Include module configuration:
IncludeOptional mods-enabled/*.load
IncludeOptional mods-enabled/*.conf

# Include list of ports to listen on
Include ports.conf


# Sets the default security model of the Apache2 HTTPD server. It does
# not allow access to the root filesystem outside of /usr/share and /var/www.
# The former is used by web applications packaged in Debian,
# the latter may be used for local directories served by the web server. If
# your system is serving content from a sub-directory in /srv you must allow
# access here, or in any related virtual host.
<Directory />
Options FollowSymLinks
AllowOverride None
Require all denied
</Directory>

<Directory /usr/share>
AllowOverride None
Require all granted
</Directory>

<Directory /var/www/>
Options Indexes FollowSymLinks
AllowOverride None
Require all granted
</Directory>

#<Directory /srv/>
# Options Indexes FollowSymLinks
# AllowOverride None
# Require all granted
#</Directory>


# AccessFileName: The name of the file to look for in each directory
# for additional configuration directives. See also the AllowOverride
# directive.
#
AccessFileName .htaccess

# The following lines prevent .htaccess and .htpasswd files from being
# viewed by Web clients.
#
<FilesMatch "^\.ht">
Require all denied
</FilesMatch>


# The following directives define some format nicknames for use with
# a CustomLog directive.
# These deviate from the Common Log Format definitions in that they use %O
# (the actual bytes sent including headers) instead of %b (the size of the
# requested file), because the latter makes it impossible to detect partial
# requests.
#
# Note that the use of %{X-Forwarded-For}i instead of %h is not recommended.
# Use mod_remoteip instead.
#
LogFormat "%v:%p %h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" vhost_combined
LogFormat "%h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" combined
LogFormat "%h %l %u %t \"%r\" %>s %O" common
LogFormat "%{Referer}i -> %U" referer
LogFormat "%{User-agent}i" agent

# Include of directories ignores editors' and dpkg's backup files,
# see README.Debian for details.

# Include generic snippets of statements
IncludeOptional conf-enabled/*.conf

# Include the virtual host configurations:
IncludeOptional sites-enabled/*.conf

# vim: syntax=apache ts=4 sw=4 sts=4 sr noet

Include /etc/phpmyadmin/apache.conf

User avatar
DougieLawson
Posts: 33348
Joined: Sun Jun 16, 2013 11:19 pm
Location: Basingstoke, UK
Contact: Website

Re: More than one Wordpress in my Raspberry Pi

Mon Jul 30, 2018 4:58 pm

This is a crude and ugly hack

sudo -i
cd /var/www
chown -R root.www-data *
find . -type f | xargs chmod 664
find . -type d | xargs chmod 775
exit


It means your web server userid can write any file & any directory below /var/www.

You can change back to root.root ownership and chmod 644/755 for stuff later.
Microprocessor, Raspberry Pi & Arduino Hacker
Mainframe database troubleshooter
MQTT Evangelist
Twitter: @DougieLawson

2012-18: 1B*5, 2B*2, B+, A+, Z, ZW, 3Bs*3, 3B+

Any DMs sent on Twitter will be answered next month.

luisserrano
Posts: 28
Joined: Mon Nov 27, 2017 4:49 pm

Re: More than one Wordpress in my Raspberry Pi

Tue Jul 31, 2018 8:52 am

DougieLawson wrote:
Mon Jul 30, 2018 4:58 pm
This is a crude and ugly hack

sudo -i
cd /var/www
chown -R root.www-data *
find . -type f | xargs chmod 664
find . -type d | xargs chmod 775
exit


It means your web server userid can write any file & any directory below /var/www.

You can change back to root.root ownership and chmod 644/755 for stuff later.

Thanks Dougie. The point is I dont trying to get a special server skill using a hack (please dont get me wrong, I love and appreciate your help so much but, as far as I know, nobody needs a hack to get several Wordpress sites working on Debian at same time. So I guess what I need is fix the problem, not dodge it.

If I did something wrong configuring apache, server folders or my .htaccess is corrupt, I would like to fix it and use it normally with no hack or bypass needed, to use several Wordpress installation as other users do.

Anyway, that hack sounds promising if I can´t find the right solution. My bloody question now is "What I made wrong setting the server?"

Thanks again Dougie.

User avatar
DougieLawson
Posts: 33348
Joined: Sun Jun 16, 2013 11:19 pm
Location: Basingstoke, UK
Contact: Website

Re: More than one Wordpress in my Raspberry Pi

Wed Aug 01, 2018 7:15 am

What I'd do if I were you is:

1. Shutdown the current system, pull the SDCard and put it somewhere safe
2. Get a new SDCard
3. Write Raspbian on the new SDCard
4. Boot it and install Apache2 and the other prerequisites for WP
5. Get one WP site running
6. Take a backup copy of everything in the /etc/apache2, /var/lib/mysql & /var/www folders
7. Attempt to get the second WP2 site working

If it works grab a beer & celebrate.
If it doesn't work revert to the backups.

Once you've got it working you can lift /etc/apache2, /var/lib/mysql and /var/www from the new SDCard and replace those folders on your original SDCard (which I'm assuming will have a lot of other stuff you won't want to lose).

Take notes of what you do at each step, take more notes if you need to recover from your backup.

If you can document what's needed for WP2 then WP3 should be easy.

Use the Apache2 /etc/apache/sites-available and /etc/apache2/sites-enabled stuff with a2ensite and a2dissite so that each WP site gets a self-contained /etc/apache2/sites-available/somenamehere.conf file with all of the configuration directives needed to make it work.

Give each site a distinct DocumentRoot directory.

For example (before DynDNS started charging and I didn't want to pay) I had http://cinnamon-rolls.homelinux.org the DocumentRoot for that was /var/www/org/homelinux/cinnamon-rolls.

I still do the same thing with my sites that are still active.
Microprocessor, Raspberry Pi & Arduino Hacker
Mainframe database troubleshooter
MQTT Evangelist
Twitter: @DougieLawson

2012-18: 1B*5, 2B*2, B+, A+, Z, ZW, 3Bs*3, 3B+

Any DMs sent on Twitter will be answered next month.

luisserrano
Posts: 28
Joined: Mon Nov 27, 2017 4:49 pm

Re: More than one Wordpress in my Raspberry Pi

Wed Aug 01, 2018 12:42 pm

DougieLawson wrote:
Wed Aug 01, 2018 7:15 am
What I'd do if I were you is:

1. Shutdown the current system, pull the SDCard and put it somewhere safe
2. Get a new SDCard
3. Write Raspbian on the new SDCard
4. Boot it and install Apache2 and the other prerequisites for WP
5. Get one WP site running
6. Take a backup copy of everything in the /etc/apache2, /var/lib/mysql & /var/www folders
7. Attempt to get the second WP2 site working

If it works grab a beer & celebrate.
If it doesn't work revert to the backups.

Once you've got it working you can lift /etc/apache2, /var/lib/mysql and /var/www from the new SDCard and replace those folders on your original SDCard (which I'm assuming will have a lot of other stuff you won't want to lose).

Take notes of what you do at each step, take more notes if you need to recover from your backup.

If you can document what's needed for WP2 then WP3 should be easy.

Use the Apache2 /etc/apache/sites-available and /etc/apache2/sites-enabled stuff with a2ensite and a2dissite so that each WP site gets a self-contained /etc/apache2/sites-available/somenamehere.conf file with all of the configuration directives needed to make it work.

Give each site a distinct DocumentRoot directory.

For example (before DynDNS started charging and I didn't want to pay) I had http://cinnamon-rolls.homelinux.org the DocumentRoot for that was /var/www/org/homelinux/cinnamon-rolls.

I still do the same thing with my sites that are still active.
Thanks Dougie, after a critical accident posted in another thread I have started from zero with a clean Raspbian installation.

Best regards.

Return to “Networking and servers”

Who is online

Users browsing this forum: markkuk and 12 guests