Redmine on CentOS 7 phpmyadmin : error page not found - linux

I have installed Redmine 2.5 on centos 7 with phpmyadmin and it is intalled in localhost.
but when i try 127.0.0.1/phpmyadmin or localhost/phpmyadmin i get a 404 error:
Page not found
The page you were trying to access doesn't exist or has been removed.
but phpmyadmin loads on http://127.0.0.1/phpmyadmin/index.php
when i disable virtual host localhost/phpmyadmin works.
also everything works when i assign redmine to different ipaddress.
My virtual hosts is :
<VirtualHost *:80>
ServerName www.rdmine.com
ServerAlias rdmine.com
#ServerAdmin 127.0.0.1#domain.com
DocumentRoot /var/www/redmine/public/
ErrorLog logs/redmine_error_log
<Directory "/var/www/redmine/public/">
# Options Indexes ExecCGI FollowSymLinks
# Order allow,deny
Allow from all
Options -MultiViews
# AllowOverride none
</Directory>
# These have been added:
Alias /redmine /var/www/redmine/public
<Location /redmine>
PassengerBaseURI /redmine
PassengerAppRoot /var/www/redmine
</Location>
<Directory /var/www/redmine/public>
Allow from all
Options -MultiViews
# Uncomment this if you're on Apache >= 2.4:
#Require all granted
</Directory>
</VirtualHost>
and my phpmyadmin conf is:
Alias /phpMyAdmin /usr/share/phpMyAdmin
Alias /phpmyadmin /usr/share/phpMyAdmin
<Directory /usr/share/phpMyAdmin/>
AddDefaultCharset UTF-8
<IfModule mod_authz_core.c>
# Apache 2.4
<RequireAny>
Require ip 127.0.0.1
Require ip ::1
</RequireAny>
</IfModule>
<IfModule !mod_authz_core.c>
# Apache 2.2
Order Deny,Allow
Deny from All
Allow from 127.0.0.1
Allow from ::1
Allow from all
</IfModule>
</Directory>
<Directory /usr/share/phpMyAdmin/setup/>
<IfModule mod_authz_core.c>
# Apache 2.4
<RequireAny>
Require ip 127.0.0.1
Require ip ::1
</RequireAny>
</IfModule>
<IfModule !mod_authz_core.c>
# Apache 2.2
Order Deny,Allow
Deny from All
Allow from 127.0.0.1
Allow from ::1
</IfModule>
</Directory>
# These directories do not require access over HTTP - taken from the original
# phpMyAdmin upstream tarball
#
<Directory /usr/share/phpMyAdmin/libraries/>
Order Deny,Allow
Deny from All
Allow from None
</Directory>
<Directory /usr/share/phpMyAdmin/setup/lib/>
Order Deny,Allow
Deny from All
Allow from None
</Directory>
<Directory /usr/share/phpMyAdmin/setup/frames/>
Order Deny,Allow
Deny from All
Allow from None
</Directory>
# This configuration prevents mod_security at phpMyAdmin directories from
# filtering SQL etc. This may break your mod_security implementation.
#
#<IfModule mod_security.c>
# <Directory /usr/share/phpMyAdmin/>
# SecRuleInheritance Off
# </Directory>
#</IfModule>
I want to load redmine on 127.0.0.1/redmine which it loads but it also loads on 127.0.0.0.1 and phpmyadmin on 127.0.0.1/phpmyadmin which throws an error and works only for 127.0.0.0.1/phpmyadmin/index.php
Any ideas what might be wrong?
Thank you

When you disable virtual host, there is a line in the Apache configuration such as:
DirectoryIndex index.php index.html
that takes effect. So add that line in the virtual host definition.

Related

django.urls.base.get_script_prefix returns incorrect prefix when executed by apache

Python-3.8/Django-3.2/Mezzanine-6.0 application tries to access incorrect pages when executed by apache. In standalone mode (python manage.py runserver) it creates correct address /admin/page_types/basicpage/2677/change/ whereas in apache mode it creates address /admin/page_types/basi/admin/pages/page/2677/change/ in the same place.
Edit:
It seems to be the get_script_prefix() function in django/urls/base.py that returns incorrect prefix when accessing page 2677 in apache mod_wsgi daemon mode. In embedded mode the fault does not happen.
I don't even uderstand how this fuction call return getattr(_prefixes, "value", '/') can work as the _prefixes object does not have attribute named "value".
The _prefixes object comes from asgiref:
from asgiref.local import Local
_prefixes = Local()
Furthermore: why does django use asgiref also when not not excuted using ASGI https://asgi.readthedocs.io/en/latest/ ?
Apache configuration:
[django#tkpika03p ~]$ cat /etc/httpd/conf.d/pika.conf
#
# VirtualHost template
# Files must have the .conf suffix to be loaded.
#
# NameVirtualHost statements can be added to /etc/apache2/listen.conf.
#
# Almost any Apache directive may go into a VirtualHost container.
# The first VirtualHost section is used for requests without a known
# server name.
#
<VirtualHost *:80>
ServerAdmin palvelin.hallinta#<myDomain>
ServerName pikaappm.<myDomain>
ServerAlias tkpika03p.ad.<myDomain>
DocumentRoot /srv/www/htdocs
ErrorLog /var/log/httpd/pika-error_log
CustomLog /var/log/httpd/pika-access_log combined
LogLevel warn
# don't loose time with IP address lookups
HostnameLookups Off
# needed for named virtual hosts
UseCanonicalName Off
# configures the footer on server-generated documents
ServerSignature Off
Alias /static/ /srv/django/pika/pika/static/
Alias /site/ /srv/django/pika/pika/static/site/
<IfModule wsgi_module>
WSGIDaemonProcess pika_wsgi user=django group=django home=/srv/django python-home=/srv/django/pika-env python-path=/srv/django/pika
WSGIProcessGroup pika_wsgi
WSGIScriptAlias / /srv/django/pika/pika/wsgi.py
WSGIApplicationGroup %{GLOBAL}
</IfModule>
<Directory "/">
require all granted
</Directory>
<Directory "/srv/www/htdocs">
Options Includes FollowSymLinks
AllowOverride FileInfo
<Limit GET OPTIONS>
<IfModule access_compat_module>
Order allow,deny
Allow from all
</IfModule>
<IfModule !access_compat_module>
Require all granted
</IfModule>
</Limit>
</Directory>
<Directory /srv/django/pika/pika>
<Files wsgi.py>
<IfModule access_compat_module>
Order allow,deny
Allow from all
</IfModule>
<IfModule !access_compat_module>
Require all granted
</IfModule>
</Files>
</Directory>
<Directory /srv/django/pika/pika/static>
# Options Indexes Includes FollowSymLinks
# AllowOverride FileInfo
<IfModule access_compat_module>
Order allow,deny
Allow from all
</IfModule>
<IfModule !access_compat_module>
Require all granted
</IfModule>
</Directory>
<Directory /srv/django/pika/pika/static/site>
# Options Indexes Includes FollowSymLinks
# AllowOverride FileInfo
<Limit GET OPTIONS>
<IfModule access_compat_module>
Order allow,deny
Allow from all
</IfModule>
<IfModule !access_compat_module>
Require all granted
</IfModule>
</Limit>
</Directory>
<Directory /srv/django/pika/pika/media>
# Options Indexes Includes FollowSymLinks
# AllowOverride FileInfo
<Limit GET OPTIONS>
<IfModule access_compat_module>
Order allow,deny
Allow from all
</IfModule>
<IfModule !access_compat_module>
Require all granted
</IfModule>
</Limit>
</Directory>
<Location />
Options Indexes Includes FollowSymLinks
SetOutputFilter INCLUDES
AddOutputFilter INCLUDES .html .ssi .css
# Order deny,allow
# Require all granted
</Location>
</VirtualHost>

How is it possible to run 2 Websites in 2 different subfolders on one Apache instance?

i just want to run 2 web applications which both are in seperate subfolders.
So Subfolder One (which is the Homepage) should be reachable under : example.com.
While Subfolder two should be reachable under example.com/subfolder .
I know it is somehow possible with the Apache vhosts file, but i am new to this vhost stuff und dont know, how to solve that problem.
Thanks for your help!
i just got it running like that! Is there any reason this could be a problem in sight of security?
<VirtualHost *:80>
ServerName example.com
ServerAdmin example#mail.com
Redirect permanent / https://example.com
DocumentRoot /var/www/webpage/
<Directory /var/www/webpage/>
</Directory>
</VirtualHost>
**And for SSL**
<VirtualHost *:443>
ServerAdmin example#mail.com
ServerName example.com:443
<IfModule mod_headers.c>
Header always set Strict-Transport-Security "max-age=15552000; includeSubDomains"
</IfModule>
DocumentRoot /var/www/webpage/
<Directory /var/www/webpage/>
Options FollowSymLinks
AllowOverride All
</Directory>
<Directory /var/www/webpage>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
Alias /subfolder /var/www/subfolder/
<Directory /var/www/subfolder>
Order allow,deny
allow from all
</Directory>
SSLCertificateFile /etc/certs/live/**********/fullchain.pem
SSLCertificateKeyFile /etc/certs/live/**********/privkey.pem
Include /etc/letsencrypt/options-ssl-apache.conf
</VirtualHost>

CodeIgniter 3 not working on LAMP

I have CodeIgniter 3 running locally on MAMP just fine. But, when I pull from my repo and try to set it up on an ec2 instance with LAMP installed, I get a 404. CodeIgniter is in the /var/www/html folder
My /etc/apache2/apache2.conf file contains the following:
<Directory />
Options FollowSymLinks
AllowOverride All
</Directory>
<Directory /usr/share>
AllowOverride None
Require all granted
</Directory>
<Directory /var/www>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Require all granted
</Directory>
mod_rewrite is enabled. The file /etc/apache2/sites-available/000-default.conf is as follows:
<VirtualHost *:80>
AccessFileName .htaccess
ServerAdmin admin#yourdomain.com
DocumentRoot /var/www/html/
<Directory />
AllowOverride All
Order allow,deny
allow from all
</Directory>
<Directory /var/www/html/>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
The file /var/www/html/application/config/config.php has the following settings:
$config['index_page'] = '';
$config['base_url'] = 'http://baseurl.com';
My .htaccess file is as follows:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
first you check the server configuration. you can use apache error log to find server related issue.
then check error log of application.
In database.php check the
'dbdriver' => 'mysqli',
because newest Lamp not supported
'dbdriver' => 'mysql',

htaccess not working for port 443 ssl

I have configured ssl on port 443 for my site.. I have the same site on port 80 without http .. The problem is htaccess works fine on port 80 (without ssl) but doesn't work for https (port 443)
Here is my apache2 config
<IfModule mod_ssl.c>
<VirtualHost _default_:443>
ServerAdmin webmaster#localhost
DocumentRoot /home/SiteDir/
<Directory />
Options FollowSymLinks
AllowOverride All
</Directory>
<Directory /home/SiteDir/>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
<Directory /home/SiteDir/mobile/>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
#other SSL Code
</VirtualHost>
</IfModule>

404 not found after activating Joomla 2.5 URL rewriting at localhost

I have a copy of my website at localhost at:
/var/www/vhosts/mysite.com/httpdocs
This is my /etc/apache2/sites-available/mysite
<VirtualHost *:80>
ServerAdmin webmaster#localhost
DocumentRoot /var/www/vhosts/mysite.com/httpdocs
<Directory />
Options FollowSymLinks
AllowOverride All
</Directory>
<Directory /var/www/>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
<Directory "/usr/lib/cgi-bin">
AllowOverride None
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny
Allow from all
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn
CustomLog ${APACHE_LOG_DIR}/access.log combined
Alias /doc/ "/usr/share/doc/"
<Directory "/usr/share/doc/">
Options Indexes MultiViews FollowSymLinks
AllowOverride None
Order deny,allow
Deny from all
Allow from 127.0.0.0/255.0.0.0 ::1/128
</Directory>
</VirtualHost>
I've copied htaccess.txt to .htaccess. When I activate friendly URL and URL rewriting, I get 404 errors.
I've uncommented this lines in .htaccess, but still does not work:
Options +FollowSymLinks
RewriteEngine On
RewriteBase /
I also tried to change rewritebase to
RewriteBase /mysite
with no luck.
What I'm doing wrong?
No sure if this is the issue you are experiencing, but I have experienced that rewriting does not work well on "localhost". Try and change your hosts file to say
127.0.0.1 mysite.local
And then access it on that url.
Not sure if that will work but it is worth a try.
Solved!
I had a conflict with different entries in /etc/apache2/sites-available.
When I create a new site at localhost, I copy default to mysite, and modify the mysite file to point to it's DocumentRoot.
I don't know exactly why, but if I disable default site:
sudo a2dissite default
it works.
Maybe this does'nt solve the question, but I prefer to issue another question more specific to this problem, because I've tested and it's related to different sites enabled and one or more with RewriteEngine enabled.

Resources