Apache rotatelogs not working - apache

Trying to use Apache's rotatelogs utility for rotating my Subversion access and error logs and below is my configuration:
ErrorLog "|/opt/CollabNet_Subversion/bin/rotatelogs /var/opt/CollabNet_Subversion/logs/svn_errorlog.%Y-%m-%d-%H_%M_%S 5M"
CustomLog "|/opt/CollabNet_Subversion/bin/rotatelogs /var/opt/CollabNet_Subversion/logs/svn_accesslog.%Y-%m-%d-%H_%M_%S 5M" common
and have commented out the default ErrorLog and CustomLog entries and did a restart.
but I don't see log rotation happening on the target directory.
I grepped the process id and rotatelogs process is alive
ps -ef|grep rotatelogs
root 25385 25384 0 08:16 ? 00:00:00 /opt/CollabNet_Subversion/bin/rotatelogs /var/opt/CollabNet_Subversion/logs/svn_errorlog.%Y-%m-%d-%H_%M_%S 5M
root 25386 25384 0 08:16 ? 00:00:00 /opt/CollabNet_Subversion/bin/rotatelogs /var/opt/CollabNet_Subversion/logs/svn_accesslog.%Y-%m-%d-%H_%M_%S 5M
root 25858 25384 0 08:16 ? 00:00:00 /opt/CollabNet_Subversion/bin/rotatelogs /var/opt/CollabNet_Subversion/logs/svn_accesslog.%Y-%m-%d-%H_%M_%S 5M
2585 25827 24938 0 09:27 pts/0 00:00:00 grep rotatelogs
I'm not sure where and how to debug and I'm looking to use the rotatelogs option not the logrotate utility.
OS - RHEL 6.8
svn server - svn, version 1.9.4 (r1740329)
[CollabNet flavor, not the CollabnetEdge]
(P.S: Installed using the follwing
rpm:CollabNetSubversion-server-1.9.4- 2.x86_64.rpm )

Did the log file size reach 5 MB? It won't rotate until then with the 5M setting you have.

Related

Homebrew Apache directories on MacOS Big Sur

I went thru any tutorial I could find to install and configure Apache on Big Sur. Invariably, the tutorial when discussing the config files will point to /usr/local/etc/httpd/httpd.conf that needs to be massaged a bit. The only trouble is that the file doesn't exist when I check that dir. Any idea? Thanks for your help in advance.
EDIT: I did an uninstall and install of httpd per requested and I still don't get the /usr/local/. There must be something different the homebrew configuration.
➜ ~ brew uninstall httpd
Uninstalling /opt/homebrew/Cellar/httpd/2.4.49... (1,660 files, 31.9MB)
➜ ~ brew install httpd
==> Downloading https://ghcr.io/v2/homebrew/core/httpd/manifests/2.4.49
Already downloaded: /Users/johnny/Library/Caches/Homebrew/downloads/6c60d66c3915be5c993e144a743960b9e6be26e557efeeb6c61f530c79ffed34--httpd-2.4.49.bottle_manifest.json
==> Downloading https://ghcr.io/v2/homebrew/core/httpd/blobs/sha256:e6ebcb4a1307
Already downloaded: /Users/johnny/Library/Caches/Homebrew/downloads/8506f199d5d7def536481d6fa87aa94c25201b57072d032e97edb8ce78fa86a3--httpd--2.4.49.arm64_big_sur.bottle.tar.gz
==> Pouring httpd--2.4.49.arm64_big_sur.bottle.tar.gz
==> Caveats
DocumentRoot is /opt/homebrew/var/www.
The default ports have been set in /opt/homebrew/etc/httpd/httpd.conf to 8080 and in
/opt/homebrew/etc/httpd/extra/httpd-ssl.conf to 8443 so that httpd can run without sudo.
To restart httpd after an upgrade:
brew services restart httpd
Or, if you don't want/need a background service you can just run:
/opt/homebrew/opt/httpd/bin/httpd -D FOREGROUND
==> Summary
🍺 /opt/homebrew/Cellar/httpd/2.4.49: 1,660 files, 31.9MB
➜ ~
[Edited and updated]
I am using macOS Catalina 10.15.7 / Xcode-select version 2373 and by running $ brew install httpd I can install the Apache service under /usr/local/
Can you please remove and install it again by using the same command and sharing all the output?
These are the important things:
DocumentRoot is /usr/local/var/www.
The default ports have been set in /usr/local/etc/httpd/httpd.conf to 8080 and in
/usr/local/etc/httpd/extra/httpd-ssl.conf to 8443 so that httpd can run without sudo.
To start httpd:
brew services start httpd
Or, if you don't want/need a background service you can just run:
/usr/local/opt/httpd/bin/httpd -D FOREGROUND
This is the list of directories.
$ ls -lrt /usr/local/etc/httpd
total 200
drwxr-xr-x 14 user admin 448 Sep 22 23:35 extra
-rw-r--r-- 1 user admin 21222 Sep 22 23:35 httpd.conf
-rw-r--r-- 1 user admin 13064 Sep 22 23:35 magic
-rw-r--r-- 1 user admin 60847 Sep 22 23:35 mime.types
drwxr-xr-x 4 user admin 128 Sep 22 23:35 original
And this is my test showing it is working.
$ curl localhost:8080
<html><body><h1>It works!</h1></body></html>
$ tail -f /usr/local//var/log/httpd/access_log
::1 - - [22/Sep/2021:23:39:35 -0500] "GET / HTTP/1.1" 200 45
Based on your output and the brew documentation I believe you are using Apple Silicon is that correct, can you confirm?
https://docs.brew.sh/Installation
This script installs Homebrew to its preferred prefix (/usr/local for macOS Intel, /opt/homebrew for Apple Silicon, and /home/linuxbrew/.linuxbrew for Linux) so that you don’t need sudo when you brew install. It is a careful script; it can be run even if you have stuff installed in the preferred prefix already. It tells you exactly what it will do before it does it too. You have to confirm everything it will do before it starts.

web admin noob - broke local webserver while trying to install jenkins

I just broke my local development web server while trying to install jenkins. Jenkins works. But other sites that I have built and used to access on my web server do not work.
I was following this article: https://wiki.jenkins-ci.org/display/JENKINS/Installing+Jenkins+on+Ubuntu
After following the main section to download and install jenkins, i ran the steps in the section "Setting up an Apache Proxy for port 80 -> 8080".
That's when I managed to break apache.
Here's the history of what I ran:
me#mydevbox:~$ sudo apt-get install jenkins
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
linux-image-4.2.0-34-generic linux-image-extra-4.2.0-34-generic
python-support
Use 'apt-get autoremove' to remove them.
The following extra packages will be installed:
daemon
The following NEW packages will be installed:
daemon jenkins
0 upgraded, 2 newly installed, 0 to remove and 8 not upgraded.
Need to get 64.0 MB of archives.
After this operation, 65.1 MB of additional disk space will be used.
Do you want to continue? [Y/n] Y
Get:1 http://us.archive.ubuntu.com/ubuntu/ wily/universe daemon amd64 0.6.4-1 [98.2 kB]
Get:2 http://pkg.jenkins-ci.org/debian-stable/ binary/ jenkins 1.651.2 [63.9 MB]
Fetched 64.0 MB in 6s (9,372 kB/s)
Selecting previously unselected package daemon.
(Reading database ... 433471 files and directories currently installed.)
Preparing to unpack .../daemon_0.6.4-1_amd64.deb ...
Unpacking daemon (0.6.4-1) ...
Selecting previously unselected package jenkins.
Preparing to unpack .../jenkins_1.651.2_all.deb ...
Unpacking jenkins (1.651.2) ...
Processing triggers for man-db (2.7.4-1) ...
Processing triggers for systemd (225-1ubuntu9) ...
Processing triggers for ureadahead (0.100.0-19) ...
Setting up daemon (0.6.4-1) ...
Setting up jenkins (1.651.2) ...
initctl: Unable to connect to Upstart: Failed to connect to socket /com/ubuntu/upstart: Connection refused
[ ok ] Starting jenkins (via systemctl): jenkins.service.
ln: failed to create symbolic link ‘/run/openrc/started/jenkins’: No such file or directory
Processing triggers for systemd (225-1ubuntu9) ...
Processing triggers for ureadahead (0.100.0-19) ...
me#mydevbox:~$ sudo /etc/init.d/jenkins start
[ ok ] Starting jenkins (via systemctl): jenkins.service.
me#mydevbox:~$ sudo vim /etc/default/jenkins
me#mydevbox:~$ /etc/init.d/jenkins restart
[ ok ] Restarting jenkins (via systemctl): jenkins.service.
me#mydevbox:~$
This is what I've specified for the HTTP port in the jenkins config file:
# port for HTTP connector (default 8080; disable with -1)
HTTP_PORT=8080
After that, I ran this:
me#mydevbox:~$ sudo a2enmod proxy
Enabling module proxy.
To activate the new configuration, you need to run:
service apache2 restart
me#mydevbox:~$ sudo a2enmod proxy_http
Considering dependency proxy for proxy_http:
Module proxy already enabled
Enabling module proxy_http.
To activate the new configuration, you need to run:
service apache2 restart
me#mydevbox:~$ service apache2 restart
me#mydevbox:~$ sudo a2dissite default
ERROR: Site default does not exist!
me#mydevbox:~$ sudo a2dissite 000-default
Site 000-default disabled.
To activate the new configuration, you need to run:
service apache2 reload
me#mydevbox:~$ service apache2 reload
And then I created a jenkins.conf file in /etc/apache2/sites-available/
That file looks like this:
<VirtualHost *:80>
ServerAdmin webmaster#localhost
ServerName ci.company.com
ServerAlias ci
ProxyRequests Off
<Proxy *>
Order deny,allow
Allow from all
</Proxy>
ProxyPreserveHost on
ProxyPass / http://localhost:8080/ nocanon
AllowEncodedSlashes NoDecode
</VirtualHost>
At this point, when I try to run:
http://localhost:8080/
That launches jenkins.
But I no longer can run my other sites which i launched like this:
localhost/mytestapp
The error I get is:
HTTP ERROR 404
Problem accessing /mytestapp/. Reason:
Not Found
Prior to attempting Jenkins install, I just installed apache2 and left all defaults. I would just create folders under /var/www/html and they would "just magically" appear in my browser.
Sorry for the trouble. But any help would be appreciated.
EDIT 1
I think my problem is related to this:
me#mydevbox:~$ sudo a2dissite 000-default
Site 000-default disabled.
I never noticed that in the output before. When I checked that file, it looks like that was the original conf I had.
Here's what I have in the sites-available folder:
me#mydev:/etc/apache2/sites-available$ ls -lah
total 24K
drwxr-xr-x 2 root root 4.0K May 30 11:06 .
drwxr-xr-x 8 root root 4.0K Apr 19 15:18 ..
-rw-r--r-- 1 root root 1.5K Apr 19 15:30 000-default.conf
-rw-r--r-- 1 root root 6.3K Jan 7 2014 default-ssl.conf
-rw-r--r-- 1 root root 282 May 30 11:06 jenkins.conf
me#mydev:/etc/apache2/sites-available$
So I guess I need a way to re-enable 000-default.conf and just add an entry for jenkins to use port 8080 or something like that.
Googling for examples but in the mean time, if you have any suggestions, I'd appreciate them.
Thanks.
I ran the following commands to enable both sites:
me#mydev:/etc/apache2$ sudo a2ensite 000-default
Enabling site 000-default.
To activate the new configuration, you need to run:
service apache2 reload
me#mydev:/etc/apache2$ service apache2 reload
me#mydev:/etc/apache2$ cd sites-enabled/
me#mydev:/etc/apache2/sites-enabled$ ls
000-default.conf jenkins.conf

httpd does not work (-bash: httpd: command not found)

I am on someone else's linux server (shared hosting). I do not have root access. I have determined that it's a Redhat 4.1.2-46 running as Centos Release 5.9(Final).
I have the database dump for the site and the .php files from public_html as well. What I'm TRYING TO DO is locate the httpd.conf file and get the config for that site.
when I type in
httpd - v
I get -bas: httpd: command not found - even in like the /user/sbin directory - and it's clearly running and there.
Bottom line I can't find the sitedef/conf file for www.thisparticularsite.com - and can't even figure out what version of apache I'm running...
For Apache 2 try apache2ctl -v (or sudo apache2ctl -v if root access is available). I'm on a Raspberry Pi 4B running Debian, just for reference.
The init files of apache are usually located in /etc/init.d the httpd path are found in it. However, You can find out where the httpd.conf file and httpd command directory by doing a ps aux|grep -i http. For example:
ps aux|grep -i http
510 2594 0.0 0.0 77256 1516 ? S Jul02 0:00 **/usr/sbin/httpd-0.0.0.0_80** -k start -f **/etc/httpd/conf/instances/httpd-0.0.0.0_80/httpd.conf**
root 5470 0.0 0.0 77120 872 ? Ss 2013 22:13 **/usr/sbin/httpd-0.0.0.0_80** -k start -f **/etc/httpd/conf/instances/httpd-0.0.0.0_80/httpd.conf**
Conclusion:
httpd.conf file path: **/etc/httpd/conf/instances/httpd-0.0.0.0_80/httpd.conf**
httpd command directory: **/usr/sbin/httpd-0.0.0.0_80**
As mentionned by apache.org, httpd command should not be invoked directly.
see source
If you're trying to find loaded modules, earlier the command was httpd -l. But it'll give you the same error, Command 'httpd' not found,
Nowadays, you can use apache2 -l (tested on Apache/2.4.29).

How to get Apache to follow symlink instead of downloading it?

I am just using the standard apache config file which mentions that it follows symlinks, but when I hit the url http://localhost/test it downloads the symlink file instead of following it. What config do I need to change to get apache to follow the symlink instead of downloading it?
This is an ls on the directory:
$ ls -al
total 10
drwx------+ 1 SYSTEM SYSTEM 0 Oct 20 10:55 .
drwx------+ 1 SYSTEM SYSTEM 0 Aug 26 12:27 ..
-rw-r--r--+ 1 me None 47 Oct 20 10:14 index.html
lrwxrwxrwx 1 me None 29 Oct 19 17:10 test -> /home/me/projects/test
This is in my apache config file:
<Directory "D:/Program Files (x86)/Apache Software Foundation/Apache2.2/htdocs">
Options Indexes FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all
</Directory>
I figured out the problem. The symlink I was using was made using cygwin and it crossed drives/volumes. I found out that's not allowed in windows so I had to move the files to the same drive as apache and the link is now working.

Passenger Apache 'undefined symbol: unixd_config'

I'm trying to get apache running with passenger. I did:
sudo gem install passenger
sudo passenger-install-apache2-module
After installing the other things it told me to install (e.g. apache2-prefork-dev) I added the lines it said to add to the http.conf file, and it tells me there's a syntax error on the LoadModule line.
user#machine:~$ sudo /usr/local/apache2/bin/apachectl restart
httpd: Syntax error on line 174 of /usr/local/apache2/conf/httpd.conf:
Cannot load /var/lib/gems/1.8/gems/passenger-3.0.13/ext/apache2/mod_passenger.so into server:
/var/lib/gems/1.8/gems/passenger-3.0.13/ext/apache2/mod_passenger.so: undefined symbol: unixd_config
That is referring to the following code which it told me to add:
174 LoadModule passenger_module /var/lib/gems/1.8/gems/passenger-3.0.13/ext/apache2/mod_passenger.so
175 PassengerRoot /var/lib/gems/1.8/gems/passenger-3.0.13
176 PassengerRuby /usr/bin/ruby1.8
Do you know why it can't find the unixd_config?
Thanks in advance!
Some info:
Rails v3.2.6, Ruby 1.9.2p320, gem v1.8.24, apache2 (I don't know how to find the version, but I know it's 2.x)
If it matters:
178 <VirtualHost *:80>
179 ServerName www.example.com
180 DocumentRoot /home/dylan/private/project/public
181
182 <Directory /home/dylan/private/project/public>
183 Order allow,deny
184 Allow from all
185 </Directory>
186 </VirtualHost>
(also I have no idea what to put for ServerName if you want to help me with that too...)
If you installed other apache before, you may have to need specify apache.
I tried the following command.
env APXS2=/usr/local/apache2/bin/apxs passenger-install-apache2-module
This is definitely a case of having compiled the Phusion Passenger module against the wrong Apache version. As banrui says, you need to run the installer with the AXPS2 environment variable pointing to the right apxs2 command, namely that of the Apache installation you're intending to run.
It looks like Hongli is correct.
To get your apache version:
apachectl -V (I had to be root)
From
http://httpd.apache.org/docs/2.4/developer/new_api_2_4.html
unixd_config
This has been renamed to ap_unixd_config.
You will have to rebuild passenger:
http://www.modrails.com/documentation/Users%20guide%20Apache.html
sudo ln -s /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk/usr/include /usr/include
This helped me on Yosemite. Apparently, the symlink is not automatically created with the installation of Xcode 6.1. The symlink pointed to a previous SDKs include directory. The only thing that worked was changing the symlink.