Wampserver loglevel rewrite not working - .htaccess

I am using WampServer and I would like to debug my rewrite rules from .htaccess, since I still receive 404 errors.
I already enabled rewrite_module, log_debug_module, log_forensic_module and log_config_module, but in my error log I don't receive any information about .htaccess.
In httpd.conf I changed LogLevelto: LogLevel warn mod_rewrite.c:trace8. I also tried the following options: rewrite_module, mod_rewrite.so, rewrite, mod_rewrite.
Then when I restart the server I only get this log, but I don't receive anything about web requests when I try to go to localhost/mysite.
[Sat Oct 12 17:33:07.063441 2013] [mpm_winnt:notice] [pid 8884:tid 412] AH00422: Parent: Received shutdown signal -- Shutting down the server.
[Sat Oct 12 17:33:09.063556 2013] [mpm_winnt:notice] [pid 1632:tid 288] AH00364: Child: All worker threads have exited.
[Sat Oct 12 17:33:09.078557 2013] [mpm_winnt:notice] [pid 8884:tid 412] AH00430: Parent: Child process 1632 exited successfully.
[Sat Oct 12 17:33:48.859832 2013] [mpm_winnt:notice] [pid 8252:tid 412] AH00455: Apache/2.4.4 (Win64) PHP/5.4.12 configured -- resuming normal operations
[Sat Oct 12 17:33:48.859832 2013] [mpm_winnt:notice] [pid 8252:tid 412] AH00456: Server built: Feb 22 2013 22:08:37
[Sat Oct 12 17:33:48.859832 2013] [core:notice] [pid 8252:tid 412] AH00094: Command line: 'c:\\wamp\\bin\\apache\\apache2.4.4\\bin\\httpd.exe -d C:/wamp/bin/apache/Apache2.4.4'
[Sat Oct 12 17:33:48.867833 2013] [mpm_winnt:notice] [pid 8252:tid 412] AH00418: Parent: Created child process 6216
[Sat Oct 12 17:33:49.145848 2013] [mpm_winnt:notice] [pid 6216:tid 288] AH00354: Child: Starting 150 worker threads.
UPDATE
Here is some more information about my folder structure. I have put my DirectoryRoot to D:/www and my .htaccess file is in D:/www/mysite.
Some parts from httpd.conf:
<Directory />
AllowOverride none
Require all granted
</Directory>
DocumentRoot "D:/www"
<Directory "D:/wamp/www">
Options Indexes FollowSymLinks
AllowOverride All
# Require all granted
# onlineoffline tag - don't remove
Order Deny,Allow
Deny from all
Allow from 127.0.0.1
Allow from ::1
Allow from localhost
</Directory>
#ErrorLog "logs/error.log"
ErrorLog "c:/wamp/logs/apache_error.log"
#
# LogLevel: Control the number of messages logged to the error_log.
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
#
LogLevel warn rewrite:trace3
Disabling the rewritemodule gives errors on RewriteEngine so I suppose that it does find my .htaccess file.
This is my .htaccess file:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*?)/?$ index.php/$1

Could it be that you are using Apache 2.4.x, if so they have made major changes in the area of logging.
Try
LogLevel alert rewrite:trace3
Also another change is that logged info gets written to the normal error_log file.
Documentation
ADDED After Additional Info added
You have some fairly obvious errors in your httpd.conf file.
Can I suggest you review this document on the WAMPServer forum Wampserver 2.4 What to do after Installing
I just changed my WAMPServer Apache conf as so:
LogLevel warn rewrite:trace8
And got lots of extra lines in my apache_error.log from the rewrite module.
Make sure you are actually running something on the server that will exercise mod_rewrite and the RewriteRule you have in your .htaccess
ERRORS:
#WRONG Allows access to the root of your D: drive and all subfolders, great for hackers
<Directory />
AllowOverride none
Require all granted
</Directory>
#CORRECTED
<Directory />
AllowOverride none
Require all denied
</Directory>
.
#WRONG
DocumentRoot "D:/www"
#CORRECTED
DocumentRoot "d:/wamp/www"
.
#WRONG
<Directory "D:/wamp/www">
Options Indexes FollowSymLinks
AllowOverride All
# Require all granted
# onlineoffline tag - don't remove
Order Deny,Allow
Deny from all
Allow from 127.0.0.1
Allow from ::1
Allow from localhost
</Directory>
#CORRECTED
<Directory "D:/wamp/www">
Options Indexes FollowSymLinks
AllowOverride All
# onlineoffline tag - don't remove
Require local
</Directory>

After editting yor 'httpd.conf' log to
LogLevel alert rewrite:trace3
You should restart apache server to apply changes.

Related

RewriteEngine not allowed here magento and apache2 on VPS

I've just installed Magento on my VPS (Debian 11), I must say Magento it's a pain compared to PretaShop and Wordpress, but I really need it.
After a painful installation, I run the page and I get the following:
Internal Server Error The server encountered an internal error or
misconfiguration and was unable to complete your request.
Please contact the server administrator at info#magento.mywebsite.ie to
inform them of the time this error occurred, and the actions you
performed just before this error.
More information about this error may be available in the server error
log.
Additionally, a 500 Internal Server Error error was encountered while
trying to use an ErrorDocument to handle the request.
Then I thought to check logs. So I opened the file magento.mywebsite.ie.error.log and there is a list of all the attempts, like the following:
[Sun Oct 23 17:04:41.916039 2022] [core:alert] [pid 886340:tid
139973219006208] [client 51.37.89.15:0]
/home/elliot/web/magento.mywebsite.ie/public_html/magento2/.htaccess:
RewriteEngine not allowed here [Sun Oct 23 17:04:42.225156 2022]
[core:alert] [pid 886340:tid 139973202220800] [client 51.37.89.15:0]
/home/elliot/web/magento.mywebsite.ie/public_html/magento2/.htaccess:
RewriteEngine not allowed here [Sun Oct 23 17:04:42.495916 2022]
[core:alert] [pid 886340:tid 139973185435392] [client 51.37.89.15:0]
/home/elliot/web/magento.mywebsite.ie/public_html/magento2/.htaccess:
RewriteEngine not allowed here [Sun Oct 23 17:04:42.705350 2022]
[core:alert] [pid 886340:tid 139973168649984] [client 51.37.89.15:0]
/home/elliot/web/magento.mywebsite.ie/public_html/magento2/.htaccess:
RewriteEngine not allowed here [Sun Oct 23 17:04:42.909888 2022]
[core:alert] [pid 886340:tid 139973311325952] [client 51.37.89.15:0]
/home/elliot/web/magento.mywebsite.ie/public_html/magento2/.htaccess:
RewriteEngine not allowed here [Sun Oct 23 17:05:22.958733 2022]
[core:alert] [pid 886660:tid 140355403986688] [client 51.37.89.15:0]
/home/elliot/web/magento.mywebsite.ie/public_html/magento2/.htaccess:
RewriteEngine not allowed here
The files .htaccess in my Magento new installation are exactly identical to the .htaccess that you would find here on GitHub:
Link: https://github.com/magento/magento2
You will find .htaccess in the parent folder magento2, another one in the Document Root "pub" inside magento2. My opinion is that the system is using the one in the parent directory, magento2, since if I delete that .htaccess, the webpage would show "This page isn’t working" instead of "Internal Server Error", so the error message would be different in this way.
And this is apache2.ssl.conf used as configuration file:
I removed the comments here
<VirtualHost 141.146.42.11:8443>
ServerName magento.mywebsite.ie
ServerAdmin info#magento.mywebsite.ie
DocumentRoot /home/elliot/web/magento.mywebsite.ie/public_html/magento2/pub
ScriptAlias /cgi-bin/ /home/elliot/web/magento.mywebsite.ie/cgi-bin/
Alias /vstats/ /home/elliot/web/magento.mywebsite.ie/stats/
Alias /error/ /home/elliot/web/magento.mywebsite.ie/document_errors/
#SuexecUserGroup elliot elliot
CustomLog /var/log/apache2/domains/magento.mywebsite.ie.bytes bytes
CustomLog /var/log/apache2/domains/magento.mywebsite.ie.log combined
ErrorLog /var/log/apache2/domains/magento.mywebsite.ie.error.log
<Directory /home/elliot/web/magento.mywebsite.ie/stats>
AllowOverride All
</Directory>
<Directory /home/elliot/web/magento.mywebsite.ie/public_html/magento2/pub>
AllowOverride All
SSLRequireSSL
Options +Includes -Indexes +ExecCGI </Directory>
SSLEngine on
SSLVerifyClient none
SSLCertificateFile /home/elliot/conf/web/magento.mywebsite.ie/ssl/magento.mywebsite.ie.crt
SSLCertificateKeyFile /home/elliot/conf/web/magento.mywebsite.ie/ssl/magento.mywebsite.ie.key
SSLCertificateChainFile /home/elliot/conf/web/magento.mywebsite.ie/ssl/magento.mywebsite.ie.ca
<FilesMatch \.php$>
SetHandler "proxy:unix:/run/php/php8.1-fpm-magento.mywebsite.ie.sock|fcgi://localhost"
</FilesMatch>
SetEnvIf Authorization .+ HTTP_AUTHORIZATION=$0
IncludeOptional /home/elliot/conf/web/magento.mywebsite.ie/apache2.ssl.conf_*
IncludeOptional /etc/apache2/conf.d/*.inc
</VirtualHost>
Please could you be so kind to help me with this? I have no experience at all about Apache issues, then I didn't know what else info I could provide to you. Hope you can help.
I solved the problem by adding the following line with the Parent Root Directory to my apache2.ssl.conf:
<Directory /home/elliot/web/magento.mywebsite.ie/public_html/magento2>
AllowOverride All
</Directory>
In this way also the parent directory has AllowOverride All.

Apache reverse-proxy to NodeJS WebSocket Server

Before all, yes I have checked other posts like this, this or even this among others.
This being said, let me expose my case:
It works on the dev-env (localhost) completely fine (of course, it doesn't require any proxy)
I also use this curl command to confirm:
curl 'http://localhost:9021/ws' \
--http1.1 \
-H 'Pragma: no-cache' \
-H 'Sec-WebSocket-Key: W/ZEACBv+gi6xA1JeMaO/A==' \
-H 'Upgrade: websocket' \
-H 'Cache-Control: no-cache' \
-H 'Connection: Upgrade' \
-H 'Sec-WebSocket-Version: 13'
and it connects ok.
When I run it on the remote dev server, I have this Apache config:
<IfModule mod_ssl.c>
<VirtualHost *:443>
ServerName dev.remote.com
LogLevel warn
ErrorLog "| /usr/bin/rotatelogs -l /home/user/log/dev.remote.com/error.%Y-%m-%d 86400"
CustomLog "| /usr/bin/rotatelogs -l /home/user/log/dev.remote.com/access.%Y-%m-%d 86400" combined
ServerSignature Off
DocumentRoot /home/user/www/dev.remote.com
<Directory /home/user/www/dev.remote.com>
Options -Indexes +FollowSymLinks +MultiViews
AllowOverride All
Require all granted
</Directory>
<Location />
Options FollowSymLinks
</Location>
#
# Serve static files directly with Apache
#
ProxyPass /public !
Alias /public /home/user/www/dev.remote.com/public
<Directory /home/user/www/dev.remote.com/public>
Options -Indexes +FollowSymLinks +MultiViews
AllowOverride All
Require all granted
</Directory>
ProxyPass /assets !
Alias /assets /home/user/www/dev.remote.com/.next/static/assets
<Directory /home/user/www/dev.remote.com/.next/static/assets>
Options -Indexes +FollowSymLinks +MultiViews
AllowOverride All
Require all granted
</Directory>
#
# Serve the rest with NodeJS/express
#
RewriteEngine On
LogLevel alert rewrite:trace6
RewriteCond %{HTTP:Connection} upgrade [NC]
RewriteRule /ws ws://localhost:9021/ws [P]
ProxyPreserveHost On
ProxyRequests off
# WebSocket server (express) is on port 9021
ProxyPass /ws ws://localhost:9021/ws
ProxyPassReverse /ws ws://localhost:9021/ws
# HTTP server (express) is on port 9020
ProxyPass / http://localhost:9020/
ProxyPassReverse / http://localhost:9020/
<Proxy *>
Require all granted
</Proxy>
SSLCertificateFile /etc/letsencrypt/live/dev.remote.com/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/dev.remote.com/privkey.pem
Include /etc/letsencrypt/options-ssl-apache.conf
</VirtualHost>
</IfModule>
So 2 points here:
1.
I'm sure the WebSocket server is working on the remote server by testing via ssh with the previous curl command. And it connects.
2.
When I try opening the connection from the browser
ws = new WebSocket('wss://dev.remote.com/ws');
the mod_rewrite rule seems ok because the trace is like this:
[Fri May 28 17:37:16.272448 2021] [rewrite:trace2] [pid 15772] mod_rewrite.c(477): [client a.b.c.d:63015] a.b.c.d - - [dev.remote.com/sid#6916462d1a20][rid#69164d3530a0/initial] init rewrite engine with requested uri /ws
[Fri May 28 17:37:16.272475 2021] [rewrite:trace3] [pid 15772] mod_rewrite.c(477): [client a.b.c.d:63015] a.b.c.d - - [dev.remote.com/sid#6916462d1a20][rid#69164d3530a0/initial] applying pattern '/ws' to uri '/ws'
[Fri May 28 17:37:16.272505 2021] [rewrite:trace4] [pid 15772] mod_rewrite.c(477): [client a.b.c.d:63015] a.b.c.d - - [dev.remote.com/sid#6916462d1a20][rid#69164d3530a0/initial] RewriteCond: input='Upgrade' pattern='upgrade' [NC] => matched
[Fri May 28 17:37:16.272513 2021] [rewrite:trace2] [pid 15772] mod_rewrite.c(477): [client a.b.c.d:63015] a.b.c.d - - [dev.remote.com/sid#6916462d1a20][rid#69164d3530a0/initial] rewrite '/ws' -> 'ws://localhost:9021/ws'
[Fri May 28 17:37:16.272521 2021] [rewrite:trace2] [pid 15772] mod_rewrite.c(477): [client a.b.c.d:63015] a.b.c.d - - [dev.remote.com/sid#6916462d1a20][rid#69164d3530a0/initial] forcing proxy-throughput with ws://localhost:9021/ws
[Fri May 28 17:37:16.272529 2021] [rewrite:trace1] [pid 15772] mod_rewrite.c(477): [client a.b.c.d:63015] a.b.c.d - - [dev.remote.com/sid#6916462d1a20][rid#69164d3530a0/initial] go-ahead with proxy request proxy:ws://localhost:9021/ws [OK]
So I deduct the rules are working and it's actually making the request via proxy to :ws://localhost:9021/ws
But... there's no connection received in the WebSocket server.
Therefore, I get this on Chrome:
WebSocket connection to 'wss://dev.remote.com/ws' failed
The key was to have proxy_wstunnel mod active >_<
In case it helps anyone...
cd /etc/apache2/mods-enabled
sudo ln -s ../mods-available/proxy_wstunnel.load
stupid error, but I was too focused on the configuration, and it was about enabled mods

Linux/Debian Apache2 mod_rewrite internal error

i have some problems to setup my mod_rewrite for my Joomla-Site.
Im using Apache 2.2.22 on Debian.
Website is on Directory: /home/web/beta/
What i did:
1) Commands:
sudo a2enmod rewrite
sudo mkdir -p /var/run/apache2
sudo chown -R www-data /var/run/apache2
sudo a2enmod actions
sudo /etc/init.d/apache2 force-reload
2) Then i setup following file: /etc/apache2/sites-enabled/000-default
<Directory /home/web/>
Options Indexes FollowSymLinks MultiViews
AllowOverride FileInfo
3) The htaccess file at path /home/web/beta/.htaccess i set:
RewriteEngine On
(I took the .htaccess from this site: http://www.joomla-security.de/downloads.html)
Ok, now the Problem.
As long as i set the AllowOverride to FileInfo i get following error message:
Internal Server Error
The server encountered an internal error or misconfiguration and was
unable to complete your request.
Please contact the server administrator, webmaster#localhost and
inform them of the time the error occurred, and anything you might
have done that may have caused the error.
More information about this error may be available in the server error
log. Apache/2.2.22 (Debian) Server at XXXXXXX.com Port 80
What i did wrong?
Can you help me please?
EDIT: Error Log:
[Wed Nov 11 19:21:56 2015] [notice] caught SIGTERM, shutting down
[Wed Nov 11 19:21:57 2015] [notice] Apache/2.2.22 (Debian) PHP/5.4.45-0+deb7u2 configured -- resuming normal operations
[Wed Nov 11 19:21:57 2015] [alert] [client XX.XX.XX.198] /home/web/beta/.htaccess: Options not allowed here
[Wed Nov 11 19:21:58 2015] [alert] [client XX.XX.XX.198] /home/web/beta/.htaccess: Options not allowed here
[Wed Nov 11 19:21:59 2015] [alert] [client XX.XX.XX.144] /home/web/beta/.htaccess: Options not allowed here
It seems, from the errors you've posted, that you are trying to use the Options directive in .htaccess. To do that, you need to add Options to the AllowOverride directive in 000-default (cf. https://httpd.apache.org/docs/2.2/mod/core.html#options).
So change:
AllowOverride FileInfo
to
AllowOverride FileInfo Options
in 000-default.
Edit:
And if the above doesn't work, try changing it to:
AllowOverride All
And if that doesn't work then it could mean that other configuration files are getting loaded after 000-default and overwrite some of the directives.

Apache mod_wl2.4 plugin error parseJVMID

I have some issues with setting an clustered environment for weblogic and Apache. The structure is like this: 1 webserver that proxies requests to a clustered environment of 3 weblogic servers.
Everytime i send the request to the apache server , the request gets unhandled. I figured out a part of the problem , but that is something that is not intended in production. whenever i add DynamicServerList On the requests fail. When i switch it to off it works, but that means whenever a server fails , apache will still send requests to that server and user experience would be 0.
EDIT 1: I am using weblogic 12c and apache2.4 for Centos 7
EDIT 2: There is no firewall nor selinux active
Here is my config file for weblogic plugin:
<VirtualHost *:8080>
ServerAdmin postmaster#webserver2
ServerName webserver2
DocumentRoot /var/www/webserver2/htdocs
ErrorLog /var/log/httpd//webserver-error_log
CustomLog /var/log/httpd/webserver-access_log forwarded
<Directory />
AllowOverride all
Order allow,deny
Allow from all
</Directory>
DirectoryIndex index.html
<Location />
SetHandler weblogic-handler
</Location>
<IfModule mod_weblogic.c>
WeblogicCluster 192.168.166.70:8001,192.168.166.71:8001,192.168.166.69:8001
ConnectTimeoutSecs 15
ConnectRetrySecs 10
WLIOTimeoutSecs 600
DynamicServerList ON
Idempotent ON
FileCaching ON
KeepAliveSecs 60
KeepAliveEnabled ON
DebugConfigInfo ON
</IfModule>
</VirtualHost>
And the errors I get are the following:
[Mon Sep 14 09:54:58.480616 2015] [weblogic:error] [pid 15343:tid
140547949991680] [client 172.18.132.50:57991] <1534314422136982>
parseJVMID: could not resolve hostname '-1062689209'. Returning NULL
from parseJVMID
[Mon Sep 14 09:54:58.480681 2015] [weblogic:error]
[pid 15343:tid 140547949991680] [client 172.18.132.50:57991]
<1534314422136982> initJVMID: parseClusterServerList failure
[Mon Sep
14 09:55:28.481215 2015] [weblogic:error] [pid 15343:tid
140547949991680] [client 172.18.132.50:57991] <1534314422136982>
request [/clusterjsp/HaJsp.jsp] did NOT process
successfully..................

wsgi startup - why two identical processes?

I have the following config:
virtualhost:
<VirtualHost *:80>
ServerAdmin rok#localhost
ServerName lh.test.com
WSGIScriptAlias / /home/user/myapp/src/wsgi.py application-group='%{GLOBAL}' process-group='%{GLOBAL}'
WSGIDaemonProcess lh.test.com processes=1 threads=1 display-name=%{GROUP}
<Directory /home/user/myapp/src>
<Files wsgi.py>
Order deny,allow
Require all granted
</Files>
Options All
AllowOverride All
Require all granted
</Directory>
Alias /static /home/user/myapp/src/static
ErrorLog /var/log/apache2/lh.test.com-error.log
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel debug
CustomLog /var/log/apache2/lh.test.com-access.log combined
</VirtualHost>
wsgi.py:
from __future__ import unicode_literals
import os, signal, sys
sys.path.append('/home/user/apps/django-trunk')
sys.path.insert(0, '/home/user/myapp/src')
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "test.settings")
print 'starting up wsgi application...'
from django.core.wsgi import get_wsgi_application
application = get_wsgi_application()
When I start apache, it always starts two identical wsgi processes for some reason:
apache log:
Mon Jan 06 21:17:02.895219 2014] [mpm_event:notice] [pid 27628:tid 140594224048000] AH00489: Apache/2.4.6 (Ubuntu) mod_wsgi/3.4 Python/2.7.5+ configured -- resuming normal operations
[Mon Jan 06 21:17:02.895287 2014] [core:notice] [pid 27628:tid 140594224048000] AH00094: Command line: '/usr/sbin/apache2'
[Mon Jan 06 21:17:02.905771 2014] [:error] [pid 27632:tid 140594224048000] starting up wsgi application...
[Mon Jan 06 21:17:02.909542 2014] [:error] [pid 27633:tid 140594224048000] starting up wsgi application...
and ps aux:
root 27628 0.0 0.0 84196 3100 ? Ss 21:17 0:00 /usr/sbin/apache2 -k start
www-data 27632 0.1 0.3 470984 24648 ? Sl 21:17 0:00 /usr/sbin/apache2 -k start
www-data 27633 0.1 0.3 470984 24648 ? Sl 21:17 0:00 /usr/sbin/apache2 -k start
any idea why that is so?
You have the WSGIScriptAlias directive wrong:
WSGIScriptAlias / /home/user/myapp/src/wsgi.py application-group='%{GLOBAL}' process-group='%{GLOBAL}'
It should be:
WSGIScriptAlias / /home/user/myapp/src/wsgi.py application-group='%{GLOBAL}' process-group='lh.test.com'
The result is that your application isn't running in daemon mode but embedded mode, and so is running in the Apache child worker processes. As such how many processes you see is going to be up to the Apache MPM settings.
Change that directive and also set:
WSGIRestrictEmebedded On
This will turn off the ability for stuff to run in the Apache child worker process and cause an error if you stuff up your configuration and don't delegate an application to run in the daemon process group properly.
Also go read:
http://blog.dscpl.com.au/2012/10/why-are-you-using-embedded-mode-of.html

Resources