Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Mediawiki] Serve website + wiki #959

Closed
cionz0 opened this issue Jun 3, 2023 · 18 comments
Closed

[Mediawiki] Serve website + wiki #959

cionz0 opened this issue Jun 3, 2023 · 18 comments
Assignees
Labels
how-to How to issues reported by users solved stale 15 days without activity triage Triage is needed

Comments

@cionz0
Copy link

cionz0 commented Jun 3, 2023

I'm running the Mediawiki Virtualbox image and I've set a domain name for the machine so that now the wiki responds to say mydomain.com.

I've enabled both non-www to www and HTTP to HTTPS redirection.

Other than the wiki, I want to serve additional web pages. According to the docs, putting them in /opt/bitnami/apache/htdocs/ would suffice, but it does not:

  • from both mydomain.com and mydomain.com / redirects me to mydomain.com/wiki/Main_Page
  • mydomain.com/index.html returns a 404 error

I want to access web pages stored in /opt/bitnami/apache/htdocs/ when trying to access mydomain.com, while the wiki to be served under mydomain.com/wiki[/Main_Page].

How should I proceed?

@cionz0 cionz0 added the how-to How to issues reported by users label Jun 3, 2023
@github-actions github-actions bot added the triage Triage is needed label Jun 3, 2023
@mdhont
Copy link

mdhont commented Jun 13, 2023

Could you check the following guide for creating a custom PHP application:

https://docs.bitnami.com/aws/infrastructure/lamp/administration/create-custom-application-php/

@cionz0
Copy link
Author

cionz0 commented Jun 17, 2023

@mdhont unfortunately, it doesn't work

@mdhont
Copy link

mdhont commented Jun 19, 2023

Could you be more specific? Which error are you getting? Can you check the redirections with curl:

curl -LI YOUR-DOMAIN

@cionz0
Copy link
Author

cionz0 commented Jun 21, 2023

Could you be more specific? Which error are you getting? Can you check the redirections with curl:

I keep being redirected to the wiki.

curl -LI YOUR-DOMAIN

HTTP/1.1 302 Found
Date: Wed, 21 Jun 2023 07:37:17 GMT
Server: Apache
Location: https://MY_DOMAIN/
Content-Type: text/html; charset=iso-8859-1

HTTP/1.1 301 Moved Permanently
Date: Wed, 21 Jun 2023 07:37:17 GMT
Server: Apache
Location: https://www.MY_DOMAIN/
Content-Type: text/html; charset=iso-8859-1

HTTP/1.1 301 Moved Permanently
Date: Wed, 21 Jun 2023 07:37:17 GMT
Server: Apache
X-Content-Type-Options: nosniff
Vary: Accept-Encoding,Cookie
Expires: Thu, 01 Jan 1970 00:00:00 GMT
Cache-Control: private, must-revalidate, max-age=0
X-Request-Id: 14cbe122fa537a867811dae4
Last-Modified: Wed, 21 Jun 2023 07:37:17 GMT
Location: https://www.MY_DOMAIN/wiki/Main_Page
Content-Type: text/html; charset=UTF-8

HTTP/1.1 200 OK
Date: Wed, 21 Jun 2023 07:37:17 GMT
Server: Apache
X-Content-Type-Options: nosniff
Content-language: en
Vary: Accept-Encoding,Cookie
Expires: Thu, 01 Jan 1970 00:00:00 GMT
Cache-Control: private, must-revalidate, max-age=0
X-Request-Id: 4cf1ea1ae4555a6c37322bb7
Last-Modified: Tue, 09 May 2023 15:51:46 GMT
Content-Type: text/html; charset=UTF-8

@mdhont
Copy link

mdhont commented Jun 22, 2023

Did you specify the servername in the virtualHost section?

<VirtualHost *:80>
   ServerName www.subdomain.example.com
   DocumentRoot /opt/bitnami/APPNAME
   <Directory "/opt/bitnami/APPNAME">
      Options -Indexes +FollowSymLinks -MultiViews
      AllowOverride All
      Require all granted
   </Directory>
</VirtualHost>

@mdhont
Copy link

mdhont commented Jun 23, 2023

Could you run the bndiagnostic tool instead?

sudo /opt/bitnami/bndiagnostic-tool

Please share the code that shows at the end of the output.

@cionz0
Copy link
Author

cionz0 commented Jun 27, 2023

Here it is: 45e729f0-d595-118e-03cc-65147dc13ea0

@cionz0
Copy link
Author

cionz0 commented Jun 28, 2023

~$ sudo /opt/bitnami/bncert-tool 
----------------------------------------------------------------------------
Welcome to the Bitnami HTTPS Configuration tool.

----------------------------------------------------------------------------
Domains

Please provide a valid space-separated list of domains for which you wish to 
configure your web server.

Domain list []: MYDOMAIN.COM

Warning: A certificate for the list of domains you entered already exists. It 
will be used instead of generating a new one.
Press [Enter] to continue:
----------------------------------------------------------------------------
Enable/disable redirections

Please select the redirections you wish to enable or disable on your Bitnami 
installation.

Enable HTTP to HTTPS redirection [Y/n]: y
Enable non-www to www redirection [Y/n]: y
Enable www to non-www redirection [y/N]: n
----------------------------------------------------------------------------
Changes to perform

The following changes will be performed to your Bitnami installation:

1. Stop web server
2. Configure web server to use an existing Let's Encrypt certificate and renew: 
/opt/bitnami/letsencrypt/certificates/MYDOMAIN.com.crt
3. Configure a cron job to automatically renew the certificate each month
4. Configure web server name to: www.MYDOMAIN.com
5. Enable HTTP to HTTPS redirection (example: redirect http://MYDOMAIN.com to 
https://MYDOMAIN.com)
6. Enable non-www to www redirection (example: redirect MYDOMAIN.com to 
www.MYDOMAIN.com)
7. Start web server once all changes have been performed



Do you agree to these changes? [Y/n]: y
----------------------------------------------------------------------------
Create a free HTTPS certificate with Let's Encrypt

Please provide a valid e-mail address for which to associate your Let's Encrypt 
certificate.

Domain list: MYDOMAIN.com www.MYDOMAIN.com

Server name: www.MYDOMAIN.com

E-mail address []: [email protected]

The Let's Encrypt Subscriber Agreement can be found at:

https://letsencrypt.org/documents/LE-SA-v1.3-September-21-2022.pdf

Do you agree to the Let's Encrypt Subscriber Agreement? [Y/n]: y
----------------------------------------------------------------------------
Performing changes to your installation

The Bitnami HTTPS Configuration Tool will perform any necessary actions to your 
Bitnami installation. This may take some time, please be patient.

----------------------------------------------------------------------------
Success

The Bitnami HTTPS Configuration Tool succeeded in modifying your installation.

The configuration report is shown below.

Backup files:
* /opt/bitnami/apache/conf/httpd.conf.back.202306280727
* /opt/bitnami/apache/conf/bitnami/bitnami.conf.back.202306280727
* /opt/bitnami/apache/conf/bitnami/bitnami-ssl.conf.back.202306280727
* /opt/bitnami/apache/conf/vhosts/mediawiki-https-vhost.conf.back.202306280727
* /opt/bitnami/apache/conf/vhosts/mediawiki-vhost.conf.back.202306280727
* /opt/bitnami/apache/conf/vhosts/webcionzo-https-vhost.conf.back.202306280727
* /opt/bitnami/apache/conf/vhosts/webcionzo-vhost.conf.back.202306280727

Find more details in the log file:

/tmp/bncert-202306280727.log

If you find any issues, please check Bitnami Support forums at:

https://github.com/bitnami/vms

Press [Enter] to continue:

~$ 

@jotamartos
Copy link
Collaborator

Hi @cionz0,

I think I know what the problem is. The mediawiki conf files (mediawiki-vhost.conf and mediawiki-https-vhost.conf) files set the following lines at the beginning

  ServerName www.example.com
  ServerAlias *

That means that those VirtualHosts are valid for www.example.com and all (*) domains. That's why you continue accessing Mediawiki when using your other domain *****zo.com. Could you please update the Mediawiki's files to define the domains you use to access that application and restart Apache for the changes to take effect?

@cionz0
Copy link
Author

cionz0 commented Jun 30, 2023

Hi @jotamartos

just to be clear, you’re suggesting to replace www. example.com with (the real value of) www.MYDOMAIN.com everywhere, right?

I’ll give it a try in the next days, but I don’t understand why it would solve the problem:
I aim at having a landing page at www.my domain.com and the wiki at www.mydomain.com/wiki.

@mdhont
Copy link

mdhont commented Jul 4, 2023

just to be clear, you’re suggesting to replace www. example.com with (the real value of) www.MYDOMAIN.com everywhere, right?

Yes, www.example.com needs to be replaced with your own domain.

I’ll give it a try in the next days, but I don’t understand why it would solve the problem

The ServerAlias * part will make the virtual host apply for every domain. So the rules defined in that virtualhost will be applied indiscriminately to every domain. You need to create a separate virtualhost for www.mydomain.com as the wikipedia one already is configured correctly.

<VirtualHost *:80>
    ServerName www.mydomain.com
    DocumentRoot "/opt/bitnami/apache/htdocs"
   ...
</VirtualHost>

@cionz0
Copy link
Author

cionz0 commented Jul 4, 2023

Thanks for explaining.

I applied the suggested changes (and restarted services via ctlscript), but I still get redirected to the wiki.

I've run again the bndiagnostic-tool and this is the returned code: 77f0d09d-1db2-72a1-d4bf-482343137d4c

@mdhont
Copy link

mdhont commented Jul 5, 2023

Please note that you need to remove the ServerAlias * parameter from all vhosts.

@cionz0
Copy link
Author

cionz0 commented Jul 6, 2023

Commented it out ( # ServerAlias * ) and restarted services, but with no results.

@mdhont
Copy link

mdhont commented Jul 13, 2023

You could add rewrite tracing to figure out what is happening:

<VirtualHost *:80>
  ServerName www.mydomain.com
  DocumentRoot "/opt/bitnami/apache/htdocs"
...
  LogLevel alert rewrite:trace3
...
</VirtualHost>

And then check the /opt/bitnami/apache/logs/error_log file for more information.

Please note that this will slow down server performance and is only for debugging issues.

@github-actions
Copy link

This Issue has been automatically marked as "stale" because it has not had recent activity (for 15 days). It will be closed if no further activity occurs. Thanks for the feedback.

@github-actions github-actions bot added the stale 15 days without activity label Jul 29, 2023
@github-actions
Copy link

github-actions bot commented Aug 3, 2023

Due to the lack of activity in the last 5 days since it was marked as "stale", we proceed to close this Issue. Do not hesitate to reopen it later if necessary.

@github-actions github-actions bot added the solved label Aug 3, 2023
@bitnami-bot bitnami-bot closed this as not planned Won't fix, can't repro, duplicate, stale Aug 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
how-to How to issues reported by users solved stale 15 days without activity triage Triage is needed
Projects
None yet
Development

No branches or pull requests

4 participants