Discover any remaining apache logs - apache2

I am unfamiliar with Apache2 - I want to find out where the logs are going - I have this apache2.conf contents:
ServerName 0.0.0.0
ErrorLog /dev/stderr
TransferLog /dev/stdout
Mutex file:${APACHE_LOCK_DIR} default
PidFile ${APACHE_PID_FILE}
Timeout 300
KeepAlive On
MaxKeepAliveRequests 100
KeepAliveTimeout 5
User ${APACHE_RUN_USER}
Group ${APACHE_RUN_GROUP}
HostnameLookups Off
ErrorLog /dev/stderr
LogLevel warn
IncludeOptional mods-enabled/*.load
IncludeOptional mods-enabled/*.conf
Include ports.conf
<Directory "/*" >
#Options FollowSymLinks
#AllowOverride None
#Require all denied
Options Indexes FollowSymLinks Includes ExecCGI
AllowOverride All
Require all granted
Allow from all
</Directory>
LogFormat "%v:%p %h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" vhost_combined
LogFormat "%h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" combined
LogFormat "%h %l %u %t \"%r\" %>s %O" common
LogFormat "%{Referer}i -> %U" referer
LogFormat "%{User-agent}i" agent
IncludeOptional conf-available/*.conf
IncludeOptional conf-enabled/*.conf
IncludeOptional sites-enabled/*.conf
and these envvars:
unset HOME
if [ "${APACHE_CONFDIR##/etc/apache2-}" != "${APACHE_CONFDIR}" ] ; then
SUFFIX="-${APACHE_CONFDIR##/etc/apache2-}"
else
SUFFIX=
fi
export APACHE_RUN_USER=www-data
export APACHE_RUN_GROUP=www-data
export APACHE_PID_FILE=/var/run/apache2/apache2$SUFFIX.pid
export APACHE_RUN_DIR=/var/run/apache2$SUFFIX
export APACHE_LOCK_DIR=/var/lock/apache2$SUFFIX
export APACHE_LOG_DIR=/var/log/apache2$SUFFIX
export LANG=C
. /etc/default/locale
export ORACLE_HOME=/usr/lib/oracle/12.2/client64
export LD_LIBRARY_PATH=$ORACLE_HOME/lib/:$LD_LIBRARY_PATH
export NLTK_DATA=/nltk_data
does anyone know if any logs will be populated other than the logs in /var/log/apache2/*?

httpd -V or apache2ctl -V will tell you the log locations in use, there are not more locations other than that.
You should know that:
/dev/stdout is a special path that redirect everything you
write to the standard out of the process
/dev/stderr same as abobe but redirect to standard error of the
process
/dev/null same as abobe but instead of redirect, it just
discards
Extra: The default apache2 logs location is not equal to every O.S. and in some of them envvars file don't exist.

Related

Error CREATEing SolrCore 'new_core': coreNodeName missing

I have hosted Bitnami helm chart for Apache Solr in our dev cluster and when I tried to create a new core it says ,
Error CREATEing SolrCore 'new_core': coreNodeName missing {schema=schema.xml, dataDir=data, config=solrconfig.xml}
So, from official documentation, this and this link, I came to know that I have to set legacyCloud true.
So, I have logged into my zookeeper pod, and when i ran the command
/opt/bitnami/zookeeper/bin/zkCli.sh -zkhost apachesolr-dev-zookeeper:2181 -cmd clusterprop -name legacyCloud -val true
It threw the following error,
I even tried replacing host with localhost/ 127.0.0.1 and it says command not found.
After trying for 5 hours of various approaches, I am requesting for the help as in where I am doing it wrong.
Connecting to localhost:2181
ZooKeeper -server host:port -client-configuration properties-file cmd args
addWatch [-m mode] path # optional mode is one of [PERSISTENT, PERSISTENT_RECURSIVE] - default is PERSISTENT_RECURSIVE
addauth scheme auth
close
config [-c] [-w] [-s]
connect host:port
create [-s] [-e] [-c] [-t ttl] path [data] [acl]
delete [-v version] path
deleteall path [-b batch size]
delquota [-n|-b|-N|-B] path
get [-s] [-w] path
getAcl [-s] path
getAllChildrenNumber path
getEphemerals path
history
listquota path
ls [-s] [-w] [-R] path
printwatches on|off
quit
reconfig [-s] [-v version] [[-file path] | [-members serverID=host:port1:port2;port3[,...]*]] | [-add serverId=host:port1:port2;port3[,...]]* [-remove serverId[,...]*]
redo cmdno
removewatches path [-c|-d|-a] [-l]
set [-s] [-v version] path data
setAcl [-s] [-v version] [-R] path acl
setquota -n|-b|-N|-B val path
stat [-w] path
sync path
version
whoami
Command not found: Command not found apachesolr-dev-zookeeper:2181
2022-11-03 15:42:34,114 [myid:] - ERROR [main:o.a.z.u.ServiceUtils#42] - Exiting JVM with code 127
You can do two things :
create the core from terminal/command-line.
you need to create the folder with the core name into {SOLR_PATH}/server/solr/ location and then need to add the conf files and create an empty data folder also, then it will work from solr admin.

Apache2 - How to build different site with different web address

I want to create site in the same IP but with different sub folder, for example:
http://192.168.0.1/a/ --> /var/www/site_a/
http://192.168.0.1/b/ --> /var/www/site_b/
The config:
<VirtualHost *:80>
#Site name
ServerName 192.168.0.1
#Root folder
DocumentRoot /var/www/site_a/
#log
ErrorLog /var/www/binapk/logs/error.log
#Access log
CustomLog /var/www/binapk/logs/access.log combined
Alias /a /var/www/site_a/
Alias /b /var/www/site_b/
</VirtualHost>
But if you enter http://192.168.0.1 (without /a or /b), it will show the same page as http://192.168.0.1/a/, I want http://192.168.0.1/ is nothing show up.
How to do that?
The few lines that you have specifying the DocumentRoot:
#Root folder
DocumentRoot /var/www/site_a/
are pointing your http://192.169.0.1/ to the /a folder, you would want to point it at something else in order to have it load a different document.

How to add following string to batch file?

How do I add following string to batch file for add it to a file?
<VirtualHost *:80>
ServerAdmin webmaster#mydomain.dev
DocumentRoot "J:\repo\mydomain"
ServerName mydomain.dev
ErrorLog "logs/mydomain.dev-error.log"
CustomLog "logs/mydomain.dev-access.log" common
<Directory "J:\repo\mydomain">
Order allow,deny
Allow from all
Require all granted
</Directory>
</VirtualHost>
This is what I'm trying to achieve
#echo off
set /p DomName=Enter Domain Name:
Echo "<VirtualHost *:80>
ServerAdmin webmaster#mydomain.dev
DocumentRoot "J:\repo\mydomain"
ServerName mydomain.dev
ErrorLog "logs/mydomain.dev-error.log"
CustomLog "logs/mydomain.dev-access.log" common
<Directory "J:\repo\mydomain">
Order allow,deny
Allow from all
Require all granted
</Directory>
</VirtualHost>" >> "J:\xampp\apache\conf\extra\httpd-vhosts.conf"
:End
I want to replace "DomName" variable inside the string.
Thank you!!!
You need to Echo each line individually.
Simply use %domname% where you want to substitute the inputted text.
If you use the syntax
(
echo something
echo something else
)>somefilename
then a new file will be created containing the text that would have been echoed. If you want to append to anexisting file, use >> in place of >
You need to "escape" some characters which have special meaning to batch. If you want a literal > you need to code ^> if you want the literal text to be produced. Same comment for <

Keep mod_security messages out of Apache's error_log, letting it use a separate file

Having set up a new server, I'm now running v2 of mod_security. I was able to convert all my rules to the new format, and everything seems to run fine so far. Just one thing I didn't manage is to have mod_security using its own logs (instead of logging to Apache's error_log). With v1.9 I was at least able to duplicate the messages, defining an additional log file with
CustomLog /path/to/modsec_log "%h %l %u %t \"%r\" %>s %b %{mod_security-message}i" env=mod_security-relevant
But not even that works anymore. I couldn't find anything browsing the questions tagged mod-security2, aunt Google didn't turn up any useful hints either. Is there anything I might have missed?
Do you mean the audit and debug logs? I have them set at modsec2.conf like this
SecAuditLog logs/modsec_audit.log
SecDebugLog logs/modsec_debug_log
In the modsecurity_crs_10_setup.conf file (on my configuration under /usr/share/modsecurity-crs) you can disable the logs on Apache error.log
# -- [[ Alert Logging Control ]] --
# You have three options -
#
# - To log to both the Apache error_log and ModSecurity audit_log file use: "log"
# - To log *only* to the ModSecurity audit_log file use: "nolog,auditlog"
# - To log *only* to the Apache error_log file use: "log,noauditlog"
Just change SecDefaultAction to
SecDefaultAction "phase:1,deny,nolog,auditlog"
Set the Logpath in the modsecurity.conf file as follows:
SecAuditLog /root/...path../logs/modsec_audit.log ( Relative Path )

PHP-FPM is not working as expected

I am using Debian Squeeze and set up PHP-FPM with fastcgi. I have several virtual hosts defined on the same host. I defined chroot for each pool configuration but somehow it is possible to change directory and go above the root directory definition at the pool conf.
disable_functions at the conf file is not working as well. I haven't figured it out the reason.
Sample files are below:
/etc/php5/fpm/pool.d/foo.conf:
[foo]
user = foo
group = foo
listen = 127.0.0.1:9018
listen.allowed_clients = 127.0.0.1
pm = dynamic
pm.max_children = 5
pm.start_servers = 2
pm.min_spare_servers = 1
pm.max_spare_servers = 3
chroot = /var/www/foo
chdir = /
php_admin_value[disable_functions] = dir,chdir,opendir,readdir
php_admin_value[doc_root] = /var/www/foo
php_admin_value[open_basedir] = /var/www/foo
access.log = /var/log/$pool.access.log
access.format = "%R - %u %t \"%m %r%Q%q\" %s %f %{mili}d %{kilo}M %C%%"
/etc/apache2/sites-enables/foo.com:
<VirtualHost 19x.xxx.xxx.xx>
DocumentRoot /var/www/foo
ServerName foo.com
<IfModule mod_fastcgi.c>
FastCgiExternalServer /foocgi/php5-wrapper -host 127.0.0.1:9018 -user foouser -group foogroup
ScriptAlias /foocgi/ /var/www/foo/cgi-bin/
AddHandler php5-fastcgi .php
Action php5-fastcgi /foocgi/php5-wrapper
AddType application/x-httpd-php .php
<Directory /var/www/foo/cgi-bin/>
SetHandler fastcgi-script
Options +ExecCGI
</Directory>
</IfModule>
<Directory /var/www/foo>
allow from all
Options -Indexes SymLinksIfOwnerMatch
</Directory>
</VirtualHost>
/var/www/foo/cgi-bin/php5-wrapper:
#!/bin/sh
PHPRC=/etc/php5/cgi/
export PHPRC
#export PHP_FCGI_MAX_REQUESTS=5000
#export PHP_FCGI_CHILDREN=8
exec /usr/lib/cgi-bin/php
/etc/apache2/mods-enabled/fastcgi.conf:
<IfModule mod_fastcgi.c>
FastCgiConfig -autoUpdate -singleThreshold 100 -killInterval 300 -idle-timeout 240 -maxClassProcesses 1 -pass-header HTTP_AUTHORIZATION
FastCgiWrapper /usr/lib/apache2/suexec
<Directory "/var/www/cgi-bin/">
AllowOverride none
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny
Allow from all
</Directory>
</IfModule>
/var/log/foo.access.log is empty though port 9018 is LISTEN at netstat output. The site is being opened without errors also. Any idea about the chroot problem or how to make the disable_functions work?
Can you show your phpinfo()?
May you load PHP.ini from /etc/php5/cgi/php.ini and from your php-fpm config, from pool.d/* or from /etc/php5/fpm/php.ini
I say that for:
#!/bin/sh
PHPRC=/etc/php5/cgi/
export PHPRC
#export PHP_FCGI_MAX_REQUESTS=5000
#export PHP_FCGI_CHILDREN=8
exec /usr/lib/cgi-bin/php
php5-fpm is usually in /usr/sbin/php5-fpm

Resources