websocket connection via apache not established - apache

I configured httpd.conf for websockets, I am not able to establish a connection, I am getting “error reading status line from remote server”
Below are the errors and the configuration.
Configuration
<Location /socket.io/>
ProxyPass http://172.27.38.93:9090/socket.io/
ProxyPassReverse http://172.27.38.93:9090/socket.io/
</Location>
<Location /socket.io/1/websocket>
ProxyPass ws://172.27.38.93:9090/socket.io/1/websocket
ProxyPassReverse ws://172.27.38.93:9090/socket.io/1/websocket
</Location>
Error.log
[Tue Feb 04 22:04:05.675146 2014] [proxy_http:error] [pid 7342:tid 47546562103616] (20014)Internal error: [client 10.20.136.193:52095] AH01102: error reading status line from remote server 172.27.38.93:9090
[Tue Feb 04 22:04:05.675183 2014] [proxy:error] [pid 7342:tid 47546562103616] [client 10.20.136.193:52095] AH00898: Error reading from remote server returned by /socket.io/1/websocket/vTkhURqnBJdwnFRjbOt7
Pls let me know, what needs to be corrected.

Related

Apache2.4.6 Webdav not working on Centos7

I have installed Apache 2.4.6 on Centos7 official.
httpd.conf was not changed from default.
Configured webdav.conf with the following:
DavLockDB /var/www/html/DavLock
<VirtualHost *:80>
ServerAdmin webmaster#localhost
DocumentRoot /var/www/html/webdav/
ErrorLog /var/log/httpd/error.log
CustomLog /var/log/httpd/access.log combined
Alias /webdav /var/www/html/webdav
<Directory /var/www/html/webdav>
DAV On
</Directory>
</VirtualHost>
webdav directory has 755 rights. DavLock not created.
I keep getting this error and not sure what the cause might be. Have tried many things without success:
[Fri Jan 29 11:41:17.027110 2021] [dav:error] [pid 15068] [client xxx.xxx.xxx.xxx:53946] The locks could not be queried for verification against a possible "If:" header. [500, #0]
[Fri Jan 29 11:41:17.027134 2021] [dav:error] [pid 15068] [client xxx.xxx.xxx.xxx:53946] Could not open the lock database. [500, #400]
[Fri Jan 29 11:41:17.027137 2021] [dav:error] [pid 15068] (13)Permission denied: [client xxx.xxx.xxx.xxx:53946] Could not open property database. [500, #1]
any ideas are welcome
Got it working now.
all files/folders under /var/www/ are chown to apache
moved DavLock to here: /var/lib/dav/
and added this line under httpd.conf:
<IfModule mod_dav_fs.c>
# Location of the WebDAV lock database.
DAVLockDB /var/lib/dav/DavLock
</IfModule>
At this point, I am getting 403 error. Solved by executing the following:
chcon -R -t httpd_sys_content_rw_t /var/www/html/webdav/

How to run wsgi and usual site on one apache server?

I have an apache server on VPS powered by centos7.
I have a usual website here, and now I want to add flask application.
httpme.tk is my flask application
mniek.ru is my website
so, the configs looks like that:
/etc/httpd/conf.d/http_error_api.conf
<VirtualHost *>
ServerName www.httpme.tk
ServerAlias httpme.tk
WSGIDaemonProcess application user=apache group=apache threads=5
WSGIScriptAlias / /var/www/http_error_api/wsgi.py
WSGIScriptReloading On
<Directory /var/www/http_error_api>
WSGIProcessGroup application
WSGIApplicationGroup %{GLOBAL}
Order deny,allow
Allow from all
</Directory>
</VirtualHost>
/etc/httpd/conf.d/mniek.ru.conf
<VirtualHost *:80>
ServerAdmin n-i-k-i-t#yandex.ru
ServerName mniek.ru
ServerAlias www.mniek.ru
DocumentRoot /var/www/mniek.ru
<Directory /var/www/mniek.ru>
Options FollowSymLinks
AllowOverride All
Require all granted
</Directory>
ErrorLog /var/www/mniek.ru/logs/error.log
CustomLog /var/www/mniek.ru/logs/access.log common
</VirtualHost>
<VirtualHost *:443>
ServerAdmin n-i-k-i-t#yandex.ru
ServerName mniek.ru
ServerAlias www.mniek.ru
DocumentRoot /var/www/mniek.ru
<Directory /var/www/mniek.ru>
Options FollowSymLinks
AllowOverride All
Require all granted
</Directory>
ErrorLog /var/www/mniek.ru/logs/error.log
CustomLog /var/www/mniek.ru/logs/access.log common
</VirtualHost>
And my /var/www/http_error_api/wsgi.py file:
from sys import path
path.insert(0, '/var/www/http_error_api')
from main import app as application
Apache logs:
AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using 0.0.26.144. Set the 'ServerName' directive globally to suppress this message
[Sun Jul 19 07:50:35.700799 2020] [lbmethod_heartbeat:notice] [pid 65294] AH02282: No slotmem from mod_heartmonitor
[Sun Jul 19 07:50:35.725938 2020] [mpm_prefork:notice] [pid 65294] AH00163: Apache/2.4.6 (CentOS) OpenSSL/1.0.2k-fips PHP/5.4.16 mod_wsgi/3.4 Python/2.7.5 configured -- resuming normal operations
[Sun Jul 19 07:50:35.725986 2020] [core:notice] [pid 65294] AH00094: Command line: '/usr/sbin/httpd -D FOREGROUND'
[Sun Jul 19 07:55:41.639120 2020] [mpm_prefork:notice] [pid 65294] AH00170: caught SIGWINCH, shutting down gracefully
[Sun Jul 19 07:55:42.784997 2020] [suexec:notice] [pid 65403] AH01232: suEXEC mechanism enabled (wrapper: /usr/sbin/suexec)
AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using 0.0.26.144. Set the 'ServerName' directive globally to suppress this message
[Sun Jul 19 07:55:42.838510 2020] [lbmethod_heartbeat:notice] [pid 65403] AH02282: No slotmem from mod_heartmonitor
[Sun Jul 19 07:55:42.868170 2020] [mpm_prefork:notice] [pid 65403] AH00163: Apache/2.4.6 (CentOS) OpenSSL/1.0.2k-fips PHP/5.4.16 mod_wsgi/3.4 Python/2.7.5 configured -- resuming normal operations
[Sun Jul 19 07:55:42.868215 2020] [core:notice] [pid 65403] AH00094: Command line: '/usr/sbin/httpd -D FOREGROUND'
[Sun Jul 19 08:06:12.281355 2020] [mpm_prefork:notice] [pid 65403] AH00170: caught SIGWINCH, shutting down gracefully
[Sun Jul 19 08:06:13.880590 2020] [suexec:notice] [pid 65576] AH01232: suEXEC mechanism enabled (wrapper: /usr/sbin/suexec)
AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using 0.0.26.144. Set the 'ServerName' directive globally to suppress this message
[Sun Jul 19 08:06:13.935885 2020] [lbmethod_heartbeat:notice] [pid 65576] AH02282: No slotmem from mod_heartmonitor
[Sun Jul 19 08:06:13.973518 2020] [mpm_prefork:notice] [pid 65576] AH00163: Apache/2.4.6 (CentOS) OpenSSL/1.0.2k-fips PHP/5.4.16 mod_wsgi/3.4 Python/2.7.5 configured -- resuming normal operations
[Sun Jul 19 08:06:13.973573 2020] [core:notice] [pid 65576] AH00094: Command line: '/usr/sbin/httpd -D FOREGROUND'
The problem is: when I open mniek.ru, I'm getting to my website. Also, when I go to httpme.tk, I'm also getting to my website, not to my flask application. What's wrong?

Unable to connect from apache to tomcat server

Application is not working and failing with below reason. Could someone please help on this.
connectivity apache -> tomcat
Error logs
[Mon Sep 10 03:00:07.123556 2018] [proxy_ajp:error] [pid 12345]
(104)Connection reset by peer: AH01030: ajp_ilink_receive() can't
receive header
ssl_error_log
[Mon Sep 10 03:00:07.123456 2018] [proxy_ajp:error] [pid 12345]
[client 10.10.34.901:56789] AH00992: ajp_read_header:
ajp_ilink_receive failed,
Tomcat configuration
<Connector port="8009"
protocol="AJP/1.3"
maxConnections="256"
keepAliveTimeout="30000"
redirectPort="8443">
Apache configuration
ProxyPass / ajp://localhost:8009/ timeout=600
ProxyPassReverse / ajp://localhost:8009/ timeout=600
ProxyPass needs an additional argument, e.g.
ProxyPass / ajp://localhost:8009/ ...

Installed self-signed SSL certificates, Apache won't start

I'm trying to build a website which requires the Stripe payment gateway, and therefore requires SSL. I'm using XAMPP on Windows 10. After generating SSL certificate and key pair and installing in Apache, Apache no longer starts.
I'm attaching a few error messages and configs. Please help.
This is message in Apache error log. It no longer reproduces these error messages. So something must've changed. I think I tried generating the certificate and key via a different method. But Apache still won't start.
[Sun Feb 19 15:45:25.312250 2017] [ssl:emerg] [pid 6508:tid 556] AH02577: Init: SSLPassPhraseDialog builtin is not supported on Win32 (key file C:/xampp/apache/conf/ssl.key/server.key)
[Sun Feb 19 15:45:25.312250 2017] [ssl:emerg] [pid 6508:tid 556] AH02311: Fatal error initialising mod_ssl, exiting. See C:/xampp/apache/logs/error.log for more information
[Sun Feb 19 15:45:25.312250 2017] [ssl:emerg] [pid 6508:tid 556] AH02564: Failed to configure encrypted (?) private key www.loc1.dev:443:0, check C:/xampp/apache/conf/ssl.key/server.key
[Sun Feb 19 15:45:25.312250 2017] [ssl:emerg] [pid 6508:tid 556] SSL Library Error: error:0D0680A8:asn1 encoding routines:ASN1_CHECK_TLEN:wrong tag
[Sun Feb 19 15:45:25.312250 2017] [ssl:emerg] [pid 6508:tid 556] SSL Library Error: error:0D08303A:asn1 encoding routines:ASN1_TEMPLATE_NOEXP_D2I:nested asn1 error
[Sun Feb 19 15:45:25.312250 2017] [ssl:emerg] [pid 6508:tid 556] SSL Library Error: error:0D0680A8:asn1 encoding routines:ASN1_CHECK_TLEN:wrong tag
[Sun Feb 19 15:45:25.312250 2017] [ssl:emerg] [pid 6508:tid 556] SSL Library Error: error:0D07803A:asn1 encoding routines:ASN1_ITEM_EX_D2I:nested asn1 error (Type=RSA)
[Sun Feb 19 15:45:25.312250 2017] [ssl:emerg] [pid 6508:tid 556] SSL Library Error: error:04093004:rsa routines:OLD_RSA_PRIV_DECODE:RSA lib
[Sun Feb 19 15:45:25.312250 2017] [ssl:emerg] [pid 6508:tid 556] SSL Library Error: error:0D0680A8:asn1 encoding routines:ASN1_CHECK_TLEN:wrong tag
[Sun Feb 19 15:45:25.312250 2017] [ssl:emerg] [pid 6508:tid 556] SSL Library Error: error:0D07803A:asn1 encoding routines:ASN1_ITEM_EX_D2I:nested asn1 error (Type=PKCS8_PRIV_KEY_INFO)
AH00016: Configuration Failed
This is the error I get when trying to start Apache from command line.
Apache 2 is starting ...
AH00548: NameVirtualHost has no effect and will be removed in the next release C:/xampp/apache/conf/extra/httpd-vhosts.conf:26
(OS 10048)Only one usage of each socket address (protocol/network address/port) is normally permitted. : AH00072: make_sock: could not bind to address [::]:443
(OS 10048)Only one usage of each socket address (protocol/network address/port) is normally permitted. : AH00072: make_sock: could not bind to address 0.0.0.0:443
AH00451: no listening sockets available, shutting down
AH00015: Unable to open logs
Here is the error that was posted in XAMPP Control Dialog.
1:16:13 PM [Apache] Error: Apache shutdown unexpectedly.
1:16:13 PM [Apache] This may be due to a blocked port, missing dependencies,
1:16:13 PM [Apache] improper privileges, a crash, or a shutdown by another method.
1:16:13 PM [Apache] Press the Logs button to view error logs and check
1:16:13 PM [Apache] the Windows Event Viewer for more clues
1:16:13 PM [Apache] If you need more help, copy and post this
1:16:13 PM [Apache] entire log window on the forums
This is what is in httpd-vhosts.conf. I'm trying to setup SSL for loc1.dev.
<VirtualHost *:80>
DocumentRoot "C:/xampp/htdocs"
ServerName localhost
</VirtualHost>
<VirtualHost *:80>
DocumentRoot "C:/xampp/htdocs/loc.com/public_html"
ServerName loc.dev
ServerAlias www.loc.dev
<Directory "C:/xampp/htdocs/loc.com/public_html">
AllowOverride All
Require all Granted
</Directory>
</VirtualHost>
<VirtualHost *:80>
DocumentRoot "C:/xampp/htdocs/loc1.com/public_html"
ServerName loc1.dev
ServerAlias www.loc1.dev
<Directory "C:/xampp/htdocs/loc1.com/public_html">
AllowOverride All
Require all Granted
</Directory>
</VirtualHost>
<VirtualHost *:80>
DocumentRoot "C:/xampp/htdocs/foodharbor.org/public_html"
ServerName foodharbor.dev
ServerAlias www.foodharbor.dev
<Directory "C:/xampp/htdocs/foodharbor.org/public_html">
AllowOverride All
Require all Granted
</Directory>
</VirtualHost>
This is what I have in httpd-ssl.conf
<VirtualHost _default_:443>
# General setup for the virtual host
DocumentRoot "C:/xampp/htdocs/loc1.com/public_html"
ServerName www.loc1.dev
ServerAdmin jonathan.najman#gmail.com
ErrorLog "C:/xampp/apache/logs/error.log"
TransferLog "C:/xampp/apache/logs/access.log"
SSLEngine on
SSLCertificateFile "conf/ssl.crt/server.crt"
SSLCertificateKeyFile "conf/ssl.key/server.key"
</VirtualHost>
This is what is in my hosts file (C:\Windows\System32\drivers\etc\hosts).
127.0.0.1 localhost
127.0.0.1 loc.dev
127.0.0.1 loc1.dev
127.0.0.1 foodharbor.dev
Am I missing anything?
I commented out Listen 443 in httpd-ssl.conf (C:\xampp\apache\conf\extra) and now Apache starts and the site is available on https and http. There must already be a directive elsewhere directing Apache to listen on 443 ...
#
# When we also provide SSL we have to listen to the
# standard HTTP port (see above) and to the HTTPS port
#
#Listen 443

how to configure apache server to talk to HTTPS backend server?

I configured apache server as a reverse proxy and it works fine if I point a backend server as HTTP. That is:
I configured virtual host 443 like:
ProxyPass /primary/store http://localhost:9763/store/
ProxyPassReverse /primary/store http://localhost:9763/store/
Here users will access the server like https://localhost/primary/store
And this works fine... But I want to configure HTTP server like;
ProxyPass /primary/store https://localhost:9443/store/
ProxyPassReverse /primary/store https://localhost:9443/store/
When I configure like apache server gives 500 internal server error. What am I doing wrong here?
The error I get is:
The server encountered an internal error or misconfiguration and was unable to complete your request.
Please contact the server administrator, you#example.com 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.
In the apache error log it states;
nt: SSLProxyEngine]
[Mon Aug 04 00:03:26 2014] [error] proxy: HTTPS: failed to enable ssl support for [::1]:9443 (localhost)
[Mon Aug 04 00:03:31 2014] [error] [client ::1] SSL Proxy requested for localhost:443 but not enabled [Hint: SSLProxyEngine]
[Mon Aug 04 00:03:31 2014] [error] proxy: HTTPS: failed to enable ssl support for [::1]:9443 (localhost)
[Mon Aug 04 00:03:51 2014] [error] [client ::1] SSL Proxy requested for localhost:443 but not enabled [Hint: SSLProxyEngine]
[Mon Aug 04 00:03:51 2014] [error] proxy: HTTPS: failed to enable ssl support for [::1]:9443 (localhost)
How to configure http server to talk to HTTPS server?
Your server tells you exactly what you need : [Hint: SSLProxyEngine]
You need to add that directive to your VirtualHost before the Proxy directives :
SSLProxyEngine on
ProxyPass /primary/store https://localhost:9763/store/
ProxyPassReverse /primary/store https://localhost:9763/store/
See the doc for more detail.
In my case, my server was configured to work only in https mode, and error occured when I try to access http mode. So changing http://my-service to https://my-service helped.