I have made a mistake while editing config files (new kid on the block). But now our Mediawiki is not being displayed anymore correctly. The page will load but it will display akward, and the normal formatting is gone.
The page it self is white and missing all kinds of formatting
Hyperlinks are being displayed in blue, which have not been clicked
Other hyperlinks that have been clicked are being displayed in purple
Titles are being displayed in black color
I assume the error is within 000-default.conf. I tried to find the error and correct it my self but I have come to a point whereby I really require assistance. So I was hoping someone could take a look at the config and find what is faulty.
Server version: Apache/2.4.29 (Ubuntu)
Header always unset "X-Powered-By"
Header always unset "Server"
Header unset Server
ServerSignature Off
ServerTokens Full
#xSecServerSignature Undisclosed
Header set X-XSS-Protection "1; mode=block"
Header set Referrer-Policy "strict-origin"
Header set X-Robots-Tag "noindex"
Header set X-Frame-Options "SAMEORIGIN"
Header set Feature-Policy "fullscreen *"
<VirtualHost *:80>
# The ServerName directive sets the request scheme, hostname and port that
# the server uses to identify itself. This is used when creating
# redirection URLs. In the context of virtual hosts, the ServerName
# specifies what hostname must appear in the request's Host: header to
# match this virtual host. For the default virtual host (this file) this
# value is not decisive as it is used as a last resort host regardless.
# However, you must set it for any further virtual host explicitly.
#ServerName www.example.com
ServerName wiki.example.com
AllowEncodedSlashes On
Redirect permanent "/" "https://wiki.example.com"
ServerAdmin webmaster#localhost
DocumentRoot "/var/www/mediawiki/"
<Directory "/var/www/mediawiki/">
Options +FollowSymLinks +Includes +ExecCGI
AllowOverride All
RewriteEngine On
RewriteBase /mediawiki/
RewriteRule ^index\.php$ - [S=1]
RewriteRule ^load\.php$ - [S=1]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . index.php [L]
Require all granted
</Directory>
# Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
# error, crit, alert, emerg.
# It is also possible to configure the loglevel for particular
# modules, e.g.
#LogLevel info ssl:warn
#LogLevel Debug
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
# For most configuration files from conf-available/, which are
# enabled or disabled at a global level, it is possible to
# include a line for only one particular virtual host. For example the
# following line enables the CGI configuration for this host only
# after it has been globally disabled with "a2disconf".
#Include conf-available/serve-cgi-bin.conf
</VirtualHost>
SSLHonorCipherOrder on
SSLCipherSuite "EECDH+ECDSA+AESGCM EECDH+aRSA+AESGCM EECDH+ECDSA+SHA384 EECDH+ECDSA+SHA256 EECDH+aRSA+SHA384 EECDH+aRSA+SHA256 EECDH !aNULL !eNULL !LOW !3DES !MD5 !EXP !PSK !SRP !DSS !EDH !RC4"
SSLPassPhraseDialog builtin
#SSLSessionCache "shmcb:/opt/bitnami/apache2/logs/ssl_scache(512000)"
SSLSessionCacheTimeout 300
<VirtualHost *:443>
ServerName wiki.example.com"
ServerAdmin webmaster#localhost
DocumentRoot "/var/www/mediawiki/"
SSLEngine on
SSLCertificateFile "/var/www/certs/server.pem"
SSLCertificateKeyFile "/var/www/certs/server.key"
Header always set Strict-Transport-Security "max-age=63072000; includeSubDomains"
<Directory "/var/www/mediawiki/">
Options +FollowSymLinks +Includes +ExecCGI +MultiViews
AllowOverride All
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [S=1]
RewriteRule ^load\.php$ - [S=1]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . index.php [L]
Require all granted
</Directory>
<Directory "/var/www/mediawiki/cache">
Deny from all
</Directory>
<Directory "/var/www/mediawiki/images">
Deny from all
</Directory>
# Protect against bug T30235
<IfModule rewrite_module>
RewriteEngine On
RewriteOptions inherit
RewriteCond %{QUERY_STRING} \.[^\\/:*?\x22<>|%]+(#|\?|$) [nocase]
RewriteRule . - [forbidden]
# Fix for bug T64289
Options +FollowSymLinks
</IfModule>
<Directory "/var/www/mediawiki/includes">
Deny from all
</Directory>
<Directory "/var/www/mediawiki/languages">
Deny from all
</Directory>
<Directory "/var/www/mediawiki/maintenance">
Deny from all
</Directory>
<Directory "/var/www/mediawiki/mainwiki/maintenance/archives">
Deny from all
</Directory>
<Directory "/var/www/mediawiki/mainwiki/serialized">
Deny from all
</Directory>
<Directory "/var/www/mediawiki/mainwiki/tests">
Deny from all
</Directory>
#LogLevel Debug
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
#prevent https rewrite for parsoid server
<VirtualHost localhost:8142>
</VirtualHost>
It seems that RewriteRule . index.php [L] is the culprit. It processes load.php, which loads all CSS and JavaScript, breaking it.
You can press F12 in Firefox, choose "Network" tab and follow one of the load.php links in the list of loaded files. See what happens. Most probably, it gets redirected into wiki pages.
Related
I have a Vuejs App deployed at apache2 server in digitalocean , when you hit the url it forwards you to login page which is working fine and then automatic navigate me to dashboard page that have cards when I click on one of cards I get 404 page even after I edit my .htaccess file in dist
NOTE the card route is domain.com/build
I tried .htaccess configuration from docs
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.html$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.html [L]
</IfModule>
and here is my virtual host configuration
<IfModule mod_ssl.c>
<VirtualHost *:443>
ServerAdmin email
ServerName domain.com
ServerAlias www.domain.com
DocumentRoot /var/www/domain.com/public_html/app/dist
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
ProxyPass /api/ http://localhost:8000/
ProxyPassReverse /api/ http://localhost:8000/
RewriteEngine on
# Some rewrite rules in this file were disabled on your HTTPS site,
# because they have the potential to create redirection loops.
#RewriteCond %{SERVER_NAME} =domain.com
#RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
SSLCertificateFile /etc/letsencrypt/live/domain.com/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/domain.com/privkey.pem
Include /etc/letsencrypt/options-ssl-apache.conf
</VirtualHost>
</IfModule>
Nothing wrong with virtual host file, the problem was in apache2.conf file in /etc/apache2. what I need is to change this part from
<Directory /var/www/>
Options Indexes FollowSymLinks
AllowOverride None
Require all granted
</Directory>
to :
<Directory /var/www/>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
you need to change the AllowOverride attribute.
I'm using symfony4.3 and the application is hosted under vps ubuntu 18.04.
I have followed https://symfony.com/doc/current/setup/web_server_configuration.html to configure the web server but the problem is that the application doesn't work with rewrite mode, but it works when adding /public/index.
I mean www.mysite.com doesn't work. It show the folders and files but www.mysite.com/public/index.php dispaly the website content.
The domain name is secured with https
This is the configuration:
<VirtualHost *:80>
ServerAdmin webmaster#s****.com
ServerName www.s****.com
ServerAlias s****.com
# For Apache 2.4.9 or higher
# Using SetHandler avoids issues with using ProxyPassMatch in combination
# with mod_rewrite or mod_autoindex
<FilesMatch \.php$>
SetHandler proxy:fcgi://127.0.0.1:9000
# for Unix sockets, Apache 2.4.10 or higher
# SetHandler proxy:unix:/path/to/fpm.sock|fcgi://dummy
</FilesMatch>
DocumentRoot /var/www/site/public
DirectoryIndex /index.php
<Directory /var/www/site/public>
AllowOverride All
Require all granted
FallbackResource /index.php
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_URI}::$1 ^(/.+)/(.*)::\2$
RewriteRule ^(.*) - [E=BASE:%1]
# Sets the HTTP_AUTHORIZATION header removed by Apache
RewriteCond %{HTTP:Authorization} .
RewriteRule ^ - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
# Redirect to URI without front controller to prevent duplicate content
# - use Apache >= 2.3.9 and replace all L flags by END flags and remove the
# following RewriteCond (best solution)
RewriteCond %{ENV:REDIRECT_STATUS} ^$
RewriteRule ^index\.php(?:/(.*)|$) %{ENV:BASE}/$1 [R=301,L]
# If the requested filename exists, simply serve it.
# We only want to let Apache serve files and not directories.
RewriteCond %{REQUEST_FILENAME} -f
RewriteRule ^ - [L]
# Rewrite all other queries to the front controller.
RewriteRule ^ %{ENV:BASE}/index.php [L]
</IfModule>
<IfModule mod_negotiation.c>
Options -MultiViews
</IfModule>
<IfModule !mod_rewrite.c>
<IfModule mod_alias.c>
# When mod_rewrite is not available, we instruct a temporary redirect of
# the start page to the front controller explicitly so that the website
# and the generated links can still be used.
RedirectMatch 307 ^/$ /index.php/
# RedirectTemp cannot be used instead
</IfModule>
</IfModule>
</Directory>
# optionally disable the fallback resource for the asset directories
# which will allow Apache to return a 404 error when files are
# not found instead of passing the request to Symfony
<Directory /var/www/site/public/bundles>
FallbackResource disabled
</Directory>
# uncomment the following lines if you install assets as symlinks
# or run into problems when compiling LESS/Sass/CoffeeScript assets
<Directory /var/www/site>
Options FollowSymlinks
</Directory>
# Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
# error, crit, alert, emerg.
# It is also possible to configure the loglevel for particular
# modules, e.g.
#LogLevel info ssl:warn
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
# For most configuration files from conf-available/, which are
# enabled or disabled at a global level, it is possible to
# include a line for only one particular virtual host. For example the
# following line enables the CGI configuration for this host only
# after it has been globally disabled with "a2disconf".
#Include conf-available/serve-cgi-bin.conf
# optionally set the value of the environment variables used in the application
#SetEnv APP_ENV prod
#SetEnv APP_SECRET <>
#SetEnv DATABASE_URL "mysql://db_user:db_pass#host:3306/db_name"
</VirtualHost>
Solved:
I have another file default-ssl.conf , I must put those configuration inside:
<IfModule mod_ssl.c>
<VirtualHost _default_:443>
ServerAdmin contact#s****.com
ServerName www.s****.com
ServerAlias s****.com
DocumentRoot /var/www/site/public
<Directory /var/www/site/public>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Allow from All
Require all granted
<IfModule mod_rewrite.c>
# copy configuration here
</VirtualHost>
</IfModule>
I have been trying to get symfony to run, next to a directadmin install. However, after trying several solutions, I have no clue how I can fix the httpd.conf file to get it to work. I'm only getting "Apache is functioning normally" right now.
Would anyone have an idea as to what my httpd.conf should look like?
I created the httpd.conf file by setting up a custom template for directadmin, basically working from what directadmin normally supplies by itself.
This is what the part for this subdomain looks like (IP/Domain have been hidden):
<VirtualHost IP:443 >
SSLEngine on
SSLCertificateFile /usr/local/directadmin/data/users/admin/domains/DOMAIN.cert
SSLCertificateKeyFile /usr/local/directadmin/data/users/admin/domains/DOMAIN.key
SSLCACertificateFile /usr/local/directadmin/data/users/admin/domains/DOMAIN.cacert
ServerName www.sym.DOMAIN
ServerAlias www.sym.DOMAIN sym.DOMAIN
ServerAdmin webmaster#DOMAIN
DocumentRoot /home/admin/domains/DOMAIN/private_html/sym/web
ScriptAlias /cgi-bin/ /home/admin/domains/DOMAIN/public_html/sym/cgi-bin/
UseCanonicalName OFF
<IfModule !mod_ruid2.c>
SuexecUserGroup admin admin
</IfModule>
CustomLog /var/log/httpd/domains/DOMAIN.sym.bytes bytes
CustomLog /var/log/httpd/domains/DOMAIN.sym.log combined
ErrorLog /var/log/httpd/domains/DOMAIN.sym.error.log
<FilesMatch "\.(inc|php|phtml|phps|php70)$">
AddHandler "proxy:unix:/usr/local/php70/sockets/admin.sock|fcgi://localhost" .php70
</FilesMatch>
<Directory /home/admin/domains/DOMAIN/private_html/sym/web>
AllowOverride None
Order Allow,Deny
Allow from All
<IfModule mod_rewrite.c>
Options -MultiViews
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ app.php [QSA,L]
</IfModule>
</Directory>
</VirtualHost>
The differences in here compared to a default subdomain generated by directadmin, are the addition of /web behind the documentroot, and the complete "directory" settings.
Below is my vhost conf file, I can access to abc.matpho.com, other virtual host config files are good, but with VirtualDocumentRoot it just says client denied by server configuration.
<VirtualHost *:80>
Define DOCUMENT_ROOT /srv/users/matpho/apps/z-shop/public-com
Define DOCUMENT_LOGS /srv/users/matpho/logs/z-shop/com
Define LOGS_APPNAME z-shop-com_apache
Define STORE_DOMAIN_CODE %1
Define NEWRELIC_APPNAME MATPHO_SAAS_CHILD_COM
ServerName server-zshop-com
ServerAlias *.matpho.com
ModPagespeedDomain *.matpho.com
VirtualDocumentRoot ${DOCUMENT_ROOT}/${STORE_DOMAIN_CODE}
ErrorLog ${DOCUMENT_LOGS}/${LOGS_APPNAME}.error.log
CustomLog ${DOCUMENT_LOGS}/${LOGS_APPNAME}.access.log common
<Directory /srv/users/matpho/apps/z-shop/public-com/*>
Header set Access-Control-Allow-Origin "*"
Options Indexes FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
#RewriteEngine On
#RewriteCond %{REQUEST_FILENAME} !-d
#RewriteRule .+ /khong-ton-tai [L]
#SetEnvIf Request_URI "^/khong-ton-tai$" deny_access
#Order allow,deny
#Allow from all
#Deny from env=deny_access
</Directory>
<IfModule php5_module>
php_value newrelic.appname "${NEWRELIC_APPNAME}"
</IfModule>
Include "vhosts.d/core.d/*.conf"
</VirtualHost>
How could I know what really going on?
Just remove the asterisk * in <Directory /srv/users/matpho/apps/z-shop/public-com/*>
Then this will run on the cloud!
I have a web site under Symfony 2 and want to have a basic URL rewrite.
Apache mod rewrite is enabled. Apache has been restarted multiple times.
# a2enmod rewrite
Module rewrite already enabled
Virtual host seems ok
<VirtualHost *:80>
ServerName mydomain.com
ServerAlias www.mydomain.com
DocumentRoot /home/www/mydomain/web
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /home/www/mydomain/web>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
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
</VirtualHost>
And here's my .htacess
<IfModule mod_rewrite.c>
RewriteEngine On
#<IfModule mod_vhost_alias.c>
# RewriteBase /
#</IfModule>
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ app.php [QSA,L]
</IfModule>
But http://mydomain.com/ gives the "index of" page and I have to pass through http://mydomain.com/app.php/ to access my web site.
What am I missing ?!!
You need to change AllowOverride None to AllowOverride All
When this directive is set to None and AllowOverrideList is set to
None .htaccess files are completely ignored. In this case, the server
will not even attempt to read .htaccess files in the filesystem.
When not specified, AllowOverrideList is set to None
http://httpd.apache.org/docs/current/mod/core.html#allowoverride