Changing the httpd location file - apache

I want to change httpd log location on centos
the location where is install dont have a good memory
so i want to move it to /home/httpdlog/
Thanks for any helps

you can use "ErrorLog" and "CustomLog" directive (in httpd.conf file) and change the directory
please check this link :
https://serverfault.com/questions/875697/changing-apache-2-4-xs-log-files-directory-on-centos-7

Related

Run Intraweb .so on apache

I made a stand alone app and it works find Intraweb 9.4.2'
Create an apache 2 .so
project info ---
library DartsDLL;
uses
ApacheTwoApp,
IWInitApacheTwo,
DLogin in 'DLogin.pas' {IWForm1: TIWAppForm},
ServerController in 'ServerController.pas' {IWServerController:
TIWServerControllerBase},
UserSessionUnit in 'UserSessionUnit.pas' {IWUserSession: TIWUserSessionBase},
DartDM in 'DartDM.pas' {dm: TDataModule},
plyrshow in 'plyrshow.pas' {plyrs: TIWAppForm},
plyrdetail in 'plyrdetail.pas' {weekdtail: TIWAppForm},
NPlyr in 'NPlyr.pas' {FrmNewPlyr: TIWAppForm},
pidlweeks in 'pidlweeks.pas' {Tseasweeks: TIWAppForm};
{$E so}
{$R *.res}
exports
apache_module name 'webdarts_mod';
begin
IWRun;
end.
conf files have been modified
httpd2.pas has been modified
apache restarts ok.
I get no errors in apache logs.
When I try to run inside delphi I get:
Can not run unless host application is defined.
Question how do you run it?
From the menu open Run Parameters and set the host application to C:\Program Files\Apache Software Foundation\Apache2.2\bin\httpd.exe or the path where you installed Apache httpd. Another tip is to add -X to the parameters to force Apache httpd to run from a single process to not confuse the debugger.
Looking at project files the two important items are library DartsDll and apache_module name 'webdarts_mod'.
Presuming project compiles DartsDll.so will be created along with apache_module name.
Notice where apache_module name and library are used in LoadModule directive and where library name is used without ext in SetHandler.
Next you need to modify Apache httpd.conf file by adding four lines as follows;
LoadModule webdarts_mod modules/Dartsdll.so
< Location /??????>
SetHandler DartsDll-handler
< Location>
Replace the question marks with anything you desire (except any name you have already used as a apache alias) I used 'guessd'
You must copy the DartsDll.so file to the apache modules directory.
Restart Apache.
In browser just enter - localhost/guessd
If your apache has been configured correctly your .so(dll) will run.

what happen if i delete apache log file?

I have 4 files in /var/log/apache2 and I just deleted 2 of them (I do have backups). would it affect apache's logging capabilities? does apache automatically create files and write to them if they don't exist?
It will create new file automatically.
The file is deleted but the file handle remains until you reload/restart apache, at least on Rhel 7.
You can verify this by running sudo lsof | grep access_log after deleting /var/log/httpd/access_log.
You might see the file automatically getting recreated some time later when logrotate runs, as that issues a reload which would then trigger the file to be created again.

WebDAV folder quota using Apache server

I am trying to set up a WebDAV folder on my CentOS server. I have for the most part succeeded. My problem is that I am trying to set up a size limit (quota) on the folder. I found a blog that spelled out how to do that using the "DAVSATMaxAreaSize" command. However, when I restart Apache, I get the error: "Invalid command 'DAVSATMaxAreaSize', perhaps misspelled or defined by a module not included in the server configuration". Does this mean the module that supports this command is not installed? How can I fix this?
You need to recompile your apache.
Download patch from http://www.geocities.jp/t_sat7/webdav/webdav.html
Download rpm source for apache from centos repos. Patch it with patch u downloaded and recompile apache.
I had the problem on my Ubuntu 12.04 server but I didn't want to recompile my apache. I "solved" it as follows:
I created a file container using dd (for 100MB):
dd if=/dev/zero of=/var/webdav-file-container bs=1048576 count=100
And created a filesystem in that container:
mkfs.ext4 /var/webdav-file-container
Then I mounted this container as folder for my share:
mount /var/webdav-file-container /var/webdav-share
So, now the filesystem in the container has a fixed size and apache cannot write more than the 100MB.
The only thing is that the user does not know how much space is left on that share. The Windows client report the size of it's own system drive ...

Could not open configuration file /etc/apache2/apache2.conf: No such file or directory

I have just installed Ubuntu & starting with LAMP.
I installed it & it was working just fine till I installed uTorrent. Then after localhost was not opening & I tried with stopping apache & again restarting with it.
I used - sudo service apache2 restart
Now this error is coming - Could not open configuration file /etc/apache2/apache2.conf: No such file or directory
I checked there, there is no such file with this name.
Installed uTorrent is running on 8080 port...can it be problem ?
I really don't know what to do.
Is there an /etc/apache2/httpd.conf ?
If there is, have a look inside it and see what is being included i.e look for anything along the lines of:
Include /etc/apache2/apache2.conf
Basically there error is being thrown because of an incorrect pathname in a Include directive in a conf file

.htaccess produces 500 Internal Server Error

The content of .htaccess is:
php_value upload_max_filesize 64M
Works on localhost, screws up every hosting server I upload it to.
The error.log says: Invalid command 'php_value', perhaps misspelled or defined by a module not included in the server configuration
Is there another way to change the upload_max_filesize?
If php_value is not recognized as a valid command, it may be because PHP is not installed as an Apache module. Create a php file with the following contents:
<?php phpinfo();
Run the file to show your PHP configuration. Search the page (Ctr+F) for "mod_php". If you don't find it anywhere, this explains your problem.
If you have access to php.ini, you may be able to fix your problem by editing that file instead. At the phpinfo page, look at the value under Loaded Configuration File for the location of the file to edit. On Linux, it will be something such as /usr/local/lib/php.ini
Open the ini file (it's just a text file) and look for the setting you want to change. If it's not present, just add a line and set it as desired: upload_max_filesize=64M
Save the file and restart the Apache server.
If you don't want to remove the php_flag command in .htaccess but want to avoid the error, wrap the command as follows:
<IfModule mod_php5.c>
php_flag display_errors 0
php_flag display_startup_errors 0
</IfModule>
If you're using PHP7, use <IfModule mod_php7.c>
For other readers with the same problem and access to the server, this could also be caused by a misconfiguration of PHP as a module of apache. You can fix it reinstalling the module (or configuring the route to libphp.so by yourself in php.ini).
Have in mind that purge will remove the configuration of the packages which usually is nothing to worry, but you are warned just in case.
sudo apt-get purge libapache2-mod-php libapache2-mod-php7.2
sudo apt-get install libapache2-mod-php
The problem was the hosting provider, they only allow changing this via php.ini
It seems like the php module is not loaded. Make sure, it is installed with
sudo apt-get install libapache2-mod-php
and check if it is enabled in apache with
ll /etc/apache2/mods-enabled/*php*
if it is installed but not enabled, enable it (depending on your php-version) e.g. for PHP 8.0 with
sudo a2enmod php8.0.load
and restart apache
sudo apache2ctl graceful
I too was receiving a 500 internal server error. My error log showed:
Invalid command 'php_value', perhaps misspelled or defined by a module not included in the server configuration
I tried updating upload_max_filesize as suggested but it didn't work for me. The last line of my .htaccess file had:
php_value max_execution_time 120
I removed that line and the site resolved perfectly.
Create .user.ini file
Add the line upload_max_filesize="5M"