/r/apache

Photograph via snooOG

A subreddit dedicated to the Apache Webserver: here you'll find news, tips and tricks or just ask for assistance, we'll try our best to help each other!

Apache-related news, tips, and tricks.

/r/apache

4,238 Subscribers

0

Server Can't Be Found On Some Devices

I have deployed my web app to a server and I checked it and it is working fine. however on some iOS devices it doesn't open 'Safari Cannot open the page because the server can't be found'. this only happens when the phone is using Cellular Data. when it is connected to a Wi-Fi it works.

What could be the reason?

Thank you.

0 Comments
2024/12/03
21:38 UTC

1

implementing proxy server access for Apache and PrestaShop

I fairly new at this and hoping for some direction.

Using Ubuntu 22.04 with PHP8.1 and PrestaShop 8.2.0

My company's network has a proxy server and when I try to use PrestaShop for the module manager I get this error below.

My network admin says I need to make Apache and PrestaShop connect to the proxy server's IP address.

I am now lost at how to make this happen. Anyone have any pointers on how to pt this in the PHP files or is this something that is done thru Apache?

https://preview.redd.it/9cfcfixeho4e1.png?width=693&format=png&auto=webp&s=5f68c8ab004feb3e56f76d008941a1b4b0c9e8ed

0 Comments
2024/12/03
18:38 UTC

1

Lock apache to localhost

I'm wanting to lock apache to localhost so only I can access my locally developed drupal, joomla and wordpress sites. I can't seem to find a guide anywhere that explains how to do this simply. I'm using xampp on windows 10 pro with apache version 2.4.58

1 Comment
2024/12/02
11:20 UTC

1

Apache / Centos combo, trying to make 301 redirect

I have two domains, both hosted on the same Centos server, something like this:

I am trying to get everything to redirect from stupidblog.com over to stupid.blog, preserving original links, and generally ignoring any attempted subdomains

I though this would be relatively easy using my conf.d files in the /etc/httpd/conf.d/ directory, so I googled around for examples, copy/pasted them, etc... this is sort of what I'm looking like for the moment:

VirtualHost *:80>
ServerAdmin admin@stupid.blog
ServerName stupidblog.com
ServerAlias www.stupidblog.com
DocumentRoot /var/www/stupid.blog/
RedirectMatch permanent ^/(.*)$ http://stupid.blog/$1
</VirtualHost>

...but I'm getting some weird behavior. For one, it doesn't work in Chrome no matter what (on a Macbook), even in "incognito," even with cache cleared. Same with Opera.

In Safari it works (whether I'm in "Private" browsing or not). Except: if I try to go to stupidblog.com/contact, instead of taking me to stupid.blog/contact, it takes me to a "page not found" and leaves the address bar as "stupidblog.com/contact."

What am I doing wrong here? How can I get it to forward EVERY URL over to the new domain name, regardless of what the user types in their address bar?

11 Comments
2024/11/29
23:43 UTC

1

Avro IDL parser

0 Comments
2024/11/27
09:42 UTC

1

Mod_Perl Apache 24 Windows

I am running Apach 24 that i downloaded from Apache Lounge for windows.

I have a couple of Perl projects that were running in Apache 2.2 using Perl510.

I have since updated to Apache 2.4 (latest release) using Strawberry perl 538

The old setup was using mod_perl and since upgrading the system is noticeably slower, it uswd to load instantly but now seems like its not doing anything and then eventually refreshes for a second or two.

The only difference i can find is that i am not using mod_perl

I have no idea where to find the module and i am struggling to find any information on it - please help

Open to suggestions

3 Comments
2024/11/27
02:24 UTC

1

How do I access files from different drives when self-hosting via XAMPP?

Hi, I'm currently doing a self-hosting website project and I want to do sth similar to a streaming site where the index.html file is in C:/ Drive but the files are in the HDD drive (G:/). Moving it to C is not an option because there are a lot of files in G:/ and there's not enough space in C:/. I prefer not moving the entirety of apache from C to G so what are my options

1 Comment
2024/11/26
18:52 UTC

1

Apache Camel Karavan docker-compose network issue

Hello,

Could you please advise how to properly configure Keycloak in a single network?
When deploying the container and the code reaches the /ui/users/me endpoint, I receive a 500 error.

Browser
Main AuthType oidc
SsoApi User is now authenticated.
GET http://localhost:8080/ui/users/me 500 (Internal Server Error)

karavan
2024-11-22 WARN [io.qua.oid.run.OidcRecorder] (vert.x-eventloop-thread-3) OIDC server is not available at the 'http://localhost:8079/realms/karavan' URL. Please make sure it is correct. Note it has to end with a realm value if you work with Keycloak, for example: 'https://localhost:8180/auth/realms/quarkus'
2024-11-22 ERROR [io.qua.ver.htt.run.QuarkusErrorHandler] (vert.x-eventloop-thread-3) HTTP Request to /ui/users/me failed, error id: ab6d0644-18bb-4fe1-98e9-0f33808d8a60-2: io.quarkus.oidc.OIDCException: OIDC Server is not available

services:
karavan:
container_name: karavan
image: ghcr.io/apache/camel-karavan:4.8.0-oidc
ports:
- "8080:8080"
environment:
- KARAVAN_GIT_REPOSITORY=${KARAVAN_GIT_REPOSITORY}
- KARAVAN_GIT_USERNAME=${KARAVAN_GIT_USERNAME}
- KARAVAN_GIT_PASSWORD=${KARAVAN_GIT_PASSWORD}
- KARAVAN_GIT_BRANCH=main
- KARAVAN_CONTAINER_IMAGE_REGISTRY=registry:5000
- KARAVAN_CONTAINER_IMAGE_REGISTRY_USERNAME=root
- KARAVAN_CONTAINER_IMAGE_REGISTRY_PASSWORD=root
- KARAVAN_CONTAINER_IMAGE_GROUP=karavan
- KARAVAN_DOCKER_NETWORK=karavan
volumes:
- "/var/run/docker.sock:/var/run/docker.sock"
labels:
- "org.apache.camel.karavan/type=internal"
networks:
- karavan

registry:
container_name: registry
image: registry:2
restart: always
ports:
- "5555:5000"
labels:
- "org.apache.camel.karavan/type=internal"
networks:
- karavan

keycloak:
container_name: keycloak
image: quay.io/keycloak/keycloak:latest
ports:
- "8079:8080"
environment:
- KC_BOOTSTRAP_ADMIN_USERNAME=admin
- KC_BOOTSTRAP_ADMIN_PASSWORD=admin
command:
- start-dev
networks:
- karavan

networks:
karavan:
name: karavan

Variant

None

Container Management (if applicable)

Docker

Operating System (if applicable)

Linux

Version

4.8.0

0 Comments
2024/11/25
07:51 UTC

1

reverse proxy only working for test site (https://httpbin.org/)

on reddit I get 421, example.com 404 (but from their side) and usually the normal 404 from apache. the only one that works id httpbin and probably similar sites, how to fix? I can't show my config right now but I'm probably not the first one with that isssue.

12 Comments
2024/11/24
14:25 UTC

0

Webserver

I have a small class contest at school where I need to make a website on Apache 2. i was thinking on maybe a fun game using an index,ccs and JavaScript does anybody has something simple for me to use. I don’t have much time to make it myself any more since I need to be studying for my tests.

3 Comments
2024/11/24
02:22 UTC

1

Need`mod_proxy` and `mod_proxy_http`modules for Apache2 on iOS

Possible? Need this for something I am working on. Thanks in advance…

0 Comments
2024/11/23
03:04 UTC

1

Sharing files between different domains but keeping some files unique to each domain

Server: Ubuntu/Apache

Scenario:
I have a system that is used by different domains
I would like the "core" files to be used for all domains (to make maintenance easier)
However, each domain must have some of its own/exclusive directories

Example:
Core Files (accessed by domainA, domainB, etc. - all filetypes )
/var/www/corefiles

Exclusive files for each domain (read and write permission)
/var/www/domainA
/var/www/domainB

I thought about trying to solve this with vhosts:

<VirtualHost *:80>
  ServerName domainA.com
  DocumentRoot /var/www/domainA

  <Directory /var/www/domainA>
    Options Indexes FollowSymLinks
    AllowOverride All
    Require all granted
  </Directory>
  
  Alias ​​/corefiles /var/www/corefiles

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

  # Logs
  ErrorLog ${APACHE_LOG_DIR}/domainA_error.log
  CustomLog ${APACHE_LOG_DIR}/domainA_access.log combined

  # SSL
  SSLEngine on SSLCertificateFile /etc/ssl/certs/domainA.com.crt
  SSLCertificateKeyFile /etc/ssl/private/domainA.com.key

  # TMP files
  php_admin_value session.save_path "/var/www/domainA/tmp"
</VirtualHost>

And in the config.php file in each domain:

define('SERVER', 'https://domainA/');
define('APPLICATION', '/var/www/corefiles');
define('FILES', '/var/www/domainA/files');

Is this possible?
Any security issues?
Any questions about SSL certificates, cookies, PHP temp files, etc?
Any other suggestions?

Thanks

1 Comment
2024/11/21
10:11 UTC

1

Alternative to HTTP_HOST

I have my LogFormat set to include HTTP_HOST in the log, so that I can see which parked domain is being pinged. But I see a lot of the bots just show -.

Is there another variable that I should be using here that would be more accurate?

2 Comments
2024/11/21
07:06 UTC

1

Moving LogFormat to pre_main_global.conf

I use WHM/cPanel. The dashboard lets me modify LogFormat (combined), which I've done like so:

%h %l %u %t [%{HTTP_HOST}e] [%r] %>s %b [%{Referer}i] [%{User-Agent}i]

WHM updates can lose these settings without warning, though, so it's usually better to put them in pre_main_global.conf.

When I modified the error log in pre_main_global.conf, this was the format:

ErrorLogFormat "[%{u}t] [%v] [%V] [%{Request_URI}e] [pid %P:tid %T] %7F: %E: [client\ %a] %M% ,\ referer\ %{Referer}i"

How do I similarly modify LogFormat in this .conf, too?

4 Comments
2024/11/18
05:51 UTC

1

Redirect loop Apache behind Reverse Proxy

Hello,

A developer uploaded an application based on CodeIgniter to my server with this .htaccess

RewriteEngine on
RewriteBase /

# Allow access to PHP scripts in all directories


# Ensure HTTPS
RewriteCond %{HTTPS} !=on
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

# Serve existing files or directories directly
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]

# Allow access to other file types


# Fallback to index.php

RewriteRule ^([^.]+)$ /index.php?node=$1 [QSA,L]

Using this .htaccess doesn't allow me the open the website at all since it gets stuck in a redirect loop so I modified the .htaccess in the web root to this

RewriteEngine on
RewriteBase /

Header append Vary: X-Forwarded-Proto

# Serve existing files or directories directly
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]

# Allow direct access to specific static file extensions
RewriteRule \.(css|js|jpg|png|gif|ico|svg|woff|woff2|ttf|otf|eot|mp4|webm|json|xml)$ - [L]

# Fallback to index.php for all other requests
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^ index.php [QSA,L]

which allows me to at least open the application but assets like style.css are not loading since they are stuck in a redirect loop according to the browser console (cleared cache, private window, tried different browsers)

Here is my current custom.conf wich is mounted to the Apache PHP-FPM Docker container

# Disable automatic trailing slash redirect
DirectorySlash Off

# Enable Gzip compression
<IfModule mod_deflate.c>
    AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css text/javascript application/$</IfModule>

<Directory /var/www/html>
    DirectoryIndex index.php
    Options FollowSymLinks
    AllowOverride All
    Require all granted
</Directory>

<IfModule remoteip_module>
    RemoteIPHeader X-Forwarded-For
    RemoteIPTrustedProxy 172.18.0.0/16
</IfModule>

# Avoid HTTPS redirects when using a reverse proxy
<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteCond %{HTTP:X-Forwarded-Proto} !=https
    RewriteCond %{HTTPS} !=on
    RewriteRule ^ - [L]
</IfModule>

# Enable logging to the default error log file
ErrorLog /proc/self/fd/2
#LogLevel debug

LogLevel rewrite:trace8

LogFormat "%{X-Forwarded-Proto}i" xfp
CustomLog ${APACHE_LOG_DIR}/access.log xfp# Disable automatic trailing slash redirect

This is the compose.yaml for setting up the Apache PHP-FPM Docker container

---
services:
  web:
    image: shinsenter/php:8.3-fpm-apache
    container_name: PHPFPM-APACHE-NETSWERK-DEMO
    volumes:
      - /srv/lcmp_netswerk_demo/www/public_html:/var/www/html
      - /srv/lcmp_netswerk_demo/custom.conf:/etc/apache2/custom.d/custom.conf
    networks:
      - internal
      - caddy
    labels:
      caddy: demo.vanill.at
      caddy.reverse_proxy: "{{upstreams}}"
      caddy.header.Server: ""
      caddy.header.X-Forwarded-Proto: "https"
    environment:
      PHP_DISPLAY_ERRORS: "1"
      PHP_ERROR_ERROR_REPORTING: "-1"
      PHP_POST_MAX_SIZE: "1100M"
      PHP_UPLOAD_MAX_FILESIZE: "1000M"
      PHP_MAX_INPUT_VARS: "10000"
      PHP_SHORT_OPEN_TAG: "1"
      PHP_MAX_EXECUTION_TIME: "1000"
      PHP_MAX_INPUT_TIME: "1000"
      DEBUG: "1"
networks:
  caddy:
    external: true
  internal:
    driver: bridge
volumes:
  mysqldata: {}

The Apache PHP-FPM Docker container is from here

Apache PHP-FPM Docker container

0 Comments
2024/11/16
11:18 UTC

2

Config variable ${X} is not defined (Apache 2.4.37 / RHEL 8)

I'm using variables defined using systemctl edit httpd.service (which writes them to: /etc/systemd/system/httpd.service.d/override.conf) - e.g. -

[Service]

Environment=IP=192.168.10.120

etc. (additional variables also defined here)

But on service httpd configtest - I receive warnings like this:

[Fri Nov 15 10:29:21.229847 2024] [core:warn] [pid 1393147:tid 140197062199616] AH00111: Config variable ${IP} is not defined

I reference ${IP} in several shared config files (thus the per server variables) - and get the above warning for each time I call the variable.

Even though there's a warning, the variable does seem to work by the time Apache starts.

I tried adding these variables to /etc/profile - and also /etc/httpd/envars - using export IP=192.168.10.120 - but the warnings did not go away.

Is there some other place I can tell apache these variables are defined?

I read one post that mentioned this was a bug in apache's configtest code ... https://support.atomicorp.com/hc/en-us/articles/4417615850523-AH00111-Config-variable-is-not-defined

4 Comments
2024/11/15
15:47 UTC

1

Error log storing credentials

Hello,

I am currently using Apache through XAMPP in order to self-host osTicket. Currently working through some kinks on the OSTicket side of things, checked the apache error logs and found that in plain text, it was storing user login credentials.

Found it while looking at a fatal PHP error

Obviously this is not good, so I am looking for ways to either remove this or to at minimum encrypt this.

Any support is appreciated!

Thank you

0 Comments
2024/11/12
21:06 UTC

1

RemoteIP module not working with AWS NLB Proxy Protocol v2

Hello,
we are trying to implement apache httpd docker 2.4.62
this behind an AWS nlb with proxy protocol v2 turned on, if turned off everything works properly. Turning it on causes errors.
Am I missing something?

Would appreciate any help I'm newer to apache.

in my config I have
LoadModule headers_module modules/mod_headers.so
LoadModule remoteip_module modules/mod_remoteip.so

root@8b41f20ef6ed:/usr/local/apache2/logs# apachectl -M | grep remote
 remoteip_module (shared)
root@8b41f20ef6ed:/usr/local/apache2/logs# apachectl -M | grep header
 headers_module (shared)

in my virtual host I am simply trying to configure a health check on port 80 at /200/ok. This works turning proxy protocol v2 off.

<VirtualHost *:80>

        ServerName localhost
        RemoteIPProxyProtocol On
        RemoteIPHeader X-Forwarded-For
        #RemoteIPProxyProtocolExceptions *load-balancer-ips*

        Alias /200/ok /usr/local/apache2/htdocs/ok.json
        <Location "/200/ok">
                SetHandler none
                Header set Content-Type "application/json"
        </Location>

CustomLog "/usr/local/apache2/logs/access-log-80.log" combined 
        ErrorLog "/usr/local/apache2/logs/error-log-80.log"
</VirtualHost>

turning it on however gives me errors.

[Tue Nov 12 04:11:30.530815 2024] [remoteip:error] [pid 437:tid 437] [client 10.104.101.122:22405] AH03507: RemoteIPProxyProtocol: unsupported command 20
[Tue Nov 12 04:11:30.752601 2024] [remoteip:debug] [pid 438:tid 438] mod_remoteip.c(922): [client 10.104.103.177:62866] AH03503: RemoteIPProxyProtocol: enabled on connection to 172.18.0.3:80
[Tue Nov 12 04:11:30.752685 2024] [remoteip:error] [pid 438:tid 438] [client 10.104.103.177:62866] AH03507: RemoteIPProxyProtocol: unsupported command 20
[Tue Nov 12 04:11:31.056082 2024] [remoteip:debug] [pid 439:tid 439] mod_remoteip.c(922): [client 10.104.103.177:3
0 Comments
2024/11/12
20:57 UTC

1

Apache Log Parser and Data Normalization Application on github.com - Initial Release

Here's an open-source Apache Log Parser & Data Normalization solution. Python module imports Apache2 Access (LogFormats = vhost_combined, combined, common, extended) & Error logs into MySQL Schema of tables, views & functions designed to normalize data. Client & Server components capable of consolidating logs from multiple web servers & sites with Audit Trail & Error Logging! https://github.com/WillTheFarmer/ApacheLogs2MySQL

0 Comments
2024/11/09
22:34 UTC

1

I can't stop the httpd service. And everything in the Apache documentation is wrong?

I recently installed Apache on my Centos 7 cloud server.

root:/etc/httpd/conf% sudo yum list installed httpd
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: southfront.mm.fcix.net
 * extras: repo.ialab.dsu.edu
 * updates: linux-mirrors.fnal.gov
Installed Packages
httpd.x86_64                                                 2.4.6-99.el7.centos.1

Yet I can't seem to stop the httpd service at all. It's always running. I've tried everything suggested in the documentation for Apache 2.4.

Stopping and Restarting Apache HTTP Server - Apache HTTP Server Version 2.4

But none of the suggestions work. In fact, the documentation appears to be completely wrong.

  1. kill -TERM \cat /usr/local/apache2/logs/httpd.pid``

This doesn't work, because there is no /usr/local/apache2 directory. The only directories under /usr/local are the standard Linux /bin, /etc, /src, /lib, and so on. And it's strange that Apache would be adding a directory there in the first place.

  1. tail -f /usr/local/apache2/logs/error_log

Once again this doesn't work since there is no /usr/local/apache2 directory. In fact I did a system-wide search for any directories with the word "apache", and the only one I can find is /etc/selinux/targeted/active/modules/100/apache

  1. apachectl -k stop

This doesn't work because it says that passing options to apachectl is no longer supported. How could a feature already be deprecated if the documentation is for Apache 2.4?

root:/etc/httpd/conf% apachectl -k stop
Passing arguments to httpd using apachectl is no longer supported.
You can only start/stop/restart httpd using this script.
If you want to pass extra arguments to httpd, edit the
/etc/sysconfig/httpd config file.

It's confounding how none of the documentation seems to work with my installation of Apache 2.4. Are there multiple different forks of Apache 2.4 each with completely different specifications?

2 Comments
2024/11/09
15:06 UTC

1

Can't figure out a redirect for htaccess

Hosting on a IONOS non-shared managed server.

We have a PCI compliance issue that they are not able to either solve or resolve and wondered if anyone here might assist us.

It appears that anyone can access the "logs" subdir that is in the root of the server and not part of any of the directories of the domain. The PCI problem is that you can type in your user and password in plain text and unprotected with an SSL.

The IONOS response is:

Update on logs directory publicly accessible:

"This is caused by a global configuration for all webspaces on our platform. We can not change it.

However the /logs directory (which contains the access.logs among other things) is NOT publicly available. It is password protected."

So it may not be secured with HTTPS but it's password protected and can't be accessed by anyone but yourself. PCI compliance don't take that into account unfortunately

--------------------

So my idea is to redirect to another less problematic directory on the domain.

Have tried the following (real paths obfuscated for security)

When a "user" types in www.sxxxxo.co.uk/logs they go to the system logs generated by the server. (which is a dir way back down of the root and not part of any directory in the domain area)

RewriteRule /kunden/homepages/0/xxxxxxx829/htdocs/logs/ /kunden/homepages/0/xxxxxxx829/htdocs/sxxxxo.co.uk/oxxxxxxt/

But this didn't work.

Any ideas or help would be really appreciated.

Sorry if this is in the worng group............... new to reddit.

Regards

Adrian

3 Comments
2024/11/08
10:14 UTC

1

Stopping Apache from writing to stdout

I have a docker setup in which I have an Apache2 container directing traffic to a PHP container. In the PHP containers logs (docker-compose logs), 99% of the messages are something like

172.18.0.6 -  05/Nov/2024:18:00:29 +0000 "GET /dispatch.php" 200

This seems like an Apache2 access message if I'm not mistaken. So I'm confused why it's writing to the PHP containers stdout. On top of that, it's not valuable to me in prod, and so I tried changing my vhost config's LogLevel to warn, but nothing changed (which makes sense if it's an access log). I'd like to figure out what's the source of this log, and stop it from writing to stdout (but continue to write to the file I have it writing to) in prod so my logs have more valuable data. My vhost:

<VirtualHost *:80>
	ServerName my_domain.com
	DocumentRoot /var/www/

	ProxyPassMatch ^/(.*\.php(/.*)?)$ fcgi://api:9000/var/www/api/$1
	ProxyPassReverse ^/(.*\.php(/.*)?)$ fcgi://api:9000/var/www/api/$1

	<Directory /var/www/api/>
		RewriteEngine On
		RewriteBase /
		RewriteRule !\.(css|jpg|js|gif|png|ico|eot|woff|woff2|ttff|svg|psd|html)$ dispatch.php

		Options FollowSymLinks
		Require all granted
	</Directory>

	<FilesMatch "\.(png|jp?g|gif|ico|mp4|wmv|mov|mpeg|css|map|woff?|eot|svg|ttf|js|json|pdf|csv)">
		ExpiresActive on
		ExpiresDefault "access plus 30 days"
	</FilesMatch>

	ErrorLog "|/usr/bin/cronolog /var/log/my_domain/%Y/%m/%d/error.log"

	# Possible values include: debug, info, notice, warn, error, crit,
	# alert, emerg.
	LogLevel warn

	CustomLog "|/usr/bin/cronolog /var/log/my_domain/%Y/%m/%d/access.log" combined
</VirtualHost>
0 Comments
2024/11/05
21:42 UTC

2

forwarding non existen URLs to an eternal site

I would like to forward example.com/food to an Adobe Express anchor link. The /food directory currently does not exist on my server.

Can I do this in .htaccess as a rewrite rule so that anywhere I print in marketing materials the URL example.com/food it kicks over to a different website?

I'm trying to avoid paying my URL manager for hosting a custom site.

I tried both of these with no luck

Redirect 301 /food https://new.express.adobe.com/webpage/REGQ0sMUCnX4V#408-innovates-the-food-industry

RewriteRule ^food$ https://new.express.adobe.com/webpage/REGQ0sMUCnX4V#408-innovates-the-food-industry [R=302,L]

8 Comments
2024/10/18
15:25 UTC

1

Config rules, if this matches don't process any further rules

I have a lot of Apache .CONF rules set up, and I'd like to do something in the very beginning that says something like, "if THIS is true, just stop processing all further rules".

I tried this, but /.well-known/acme-challenge/foo still gets a 503 error:

RewriteEngine on

# cPanel fix, exclude DCV checks from future RewriteRules
RewriteCond %{REQUEST_URI} ^/[0-9]+\..+\.cpaneldcv$ [OR]
RewriteCond %{REQUEST_URI} ^/[A-F0-9]{32}\.txt(?:\ Comodo\ DCV)?$ [OR]

# /.well-known/ is used by AutoSSL
RewriteCond %{REQUEST_URI} ^/\.well-known|[45]\d\d\.(s?html|php)|(ad|robot)s\.txt

RewriteRule ^ - [L]

If this is the proper technique, any idea why it's not matching the third condition?

If it's not the proper technique, what should I use? Maybe [END]?

1 Comment
2024/10/17
17:39 UTC

2

Wordpress and other web app in the same root domain managing their own pages each

Hello, as the title says I am trying to acchieve that, I buy a web app from third party developers but is not great for customization so I want to use wordpress for the main theme, marketing, documentation, funnels, etc... and the webapp to offer a service.

Obviously when I install both in the same directory WordPress gains the controll and the other webapp doesn't work, I know the .htaccess can be modified to tell wordpress to only manage specific pages, the issue is that both (WP & webapp) have the same handler name (index.php) and I can not make it work that way, is there another option???

PD: not looking for subfolders, subdomains or multiple domains.

1 Comment
2024/10/16
18:48 UTC

1

Mod Rewrite with proxy pass

I have a reverse proxy setup that seems to be working well. However, I want to accomplish something that I haven't done before.

I currently have Apache running a reverse proxy to handle SSL, etc. a.domain.com.au is being forwarded to 10.2.3.4:1234/ and is working well. However, the site there (LimeSurvey) is using /index.php/ in the URL, and I want to remove this behavior.

If I set the proxy config to:

ProxyPass / http://10.2.3.4:1234/index.php/

ProxyPassReverse / http://10.2.3.4:1234/index.php/

The behavior works; however, if a link or something beyond that has /index.php in the URI, then the proxy breaks (presumably because it is being redirected to /index.php/index.php/).

How would you go about handling this scenario?

1 Comment
2024/10/15
08:54 UTC

2

You're speaking plain HTTP to an SSL-enabled server port.

Confused by this one. Is there a place I can look and fix this easily?

I just need it to redirect http to https for this one domain, If I understand correctly.

For clarity, this is a domain that is in my vhosts.

I still dont really understand why there is a vhost.conf and a vhosts-le-ssl.conf.

Couldn't they all be in one conf?

Bad Request

Your browser sent a request that this server could not understand.
Reason: You're speaking plain HTTP to an SSL-enabled server port.
Instead use the HTTPS scheme to access this URL, please.

4 Comments
2024/10/13
16:17 UTC

2

Mod_rewrite when redirect has ? question mark in query string portion

This is the second vendor we have making this more difficult than they need to be :(

I need to redirect to this (obviously included spaces to break up the URL):

https:/ / 3rdpartyhosteddomain.tld /inventory/?/listings/for-rent/equipment/all?DSCompanyID=999

and I'm getting this which doesn't resolve on their website - all? is becoming all%3f

https:/ / 3rdpartyhosteddomain.tld /inventory/?/listings/for-rent/equipment/all%3fDSCompanyID=999

I've tried escaping with backslash(es) before the question mark (in the .htaccess file). No dice. What's the trick I haven't learned yet and need to add to my arsenal ? Our DNS provider handles it okay if I place the redirect there on their DNS so it must be possible.

3 Comments
2024/10/12
16:41 UTC

1

Everything is fine until I Certbot, now links go to different vhosts

Running a wordpress host on ubuntu, and finally understanding a lot more about apache at a base level.

Im running multi vhosts to a single IP.

Everything seems to be working just fine until I run certbot and get SSL certs. After running it however, it seems to randomly pick one of the domains, and forward all the other domains to that one.

However, when I run certbot, it suddenly makes some domains redirect to a particular domain. Ive tried to figure out why but I am unable to.

I have noticed this message:

After this, domain.ltd, no longer works and forwards instead to anotherdomain.ltd.

Which makes me realize I don't really understand the rewrite piece of the config

Deploying certificate                                                                                                                            
Some rewrite rules copied from /etc/apache2/sites-enabled/httpd-vhosts.conf were disabled in the vhost for your HTTPS site located at /etc/apache
2/sites-available/httpd-vhosts-le-ssl.conf because they have the potential to create redirection loops.                                          
Successfully deployed certificate for domain.ltd to /etc/apache2/sites-available/httpd-vhosts-le-ssl.conf                                 
Congratulations! You have successfully enabled HTTPS on https://domain.ltd 

Here's the config under httpd-vhosts.conf

<VirtualHost *:80>                                                                                                            
        ServerName domain.tld                                                                                                             
        ServerAlias www.domain.tld                                                                                                        
        ServerAdmin admin@domain.tld                                                                                                    
        DocumentRoot /var/www/html/domain.tld                                                                                        
        ErrorLog ${APACHE_LOG_DIR}/error.log                                                                                                     
        CustomLog ${APACHE_LOG_DIR}/access.log combined  
</VirtualHost>

       

I don't fully understand the concept of rewrite either. The behavior seems to exist with or without the below.

RewriteEngine on                                                                                                                                 
RewriteCond %{SERVER_NAME} =domain.tld                                                                          
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]  

Note: I dont fully understand the SSL config piece, and how it relates to the Virtual Host .conf
Certbot seems to make multiple .conf's and im not sure why or how it all relates.

I also dont fully understand the rewrite bit, why is exists nor what it does exactly.

I've been able to have some success to this point by deleting the ssl.conf files.

httpd-vhosts-le-ssl.conf  or there was one httdp-vhosts-le-le-ssl.conf

Any guidance or insight would be greatly apprecaited.  This is driving me nuts.
6 Comments
2024/10/12
00:15 UTC

1

Dashboard for Apache with Geo Location based IP address

Hi all,

Please let me know, if any one using dash board ( Prometheus + Grafana ) for Apache with Geo Location map based IP address.

0 Comments
2024/10/11
17:02 UTC

Back To Top