I want to pass envrionment varaable to the apcahe2 server...
I have exported PATH Var in .bashrc file
now i want to pass it to the server...
I inserted this line 'PassEnv PATH ' to my apache.conf file..
PassEnv PATH
ScriptAlias /cgi-bin/ /home/abc/cgi-bin/
<Directory "/home/abc/cgi-bin">
Options +ExecCGI
Allow from all
</Directory>
but it still not identifying the this variable...
Pl Help me how to pass this Env var to the server..
Thanks
SetEnv APPLICATION_ENV "development"
Should do the trick. The syntax is: SetEnv Key *Value*
Related
my current log_directory path is
**/opt/demo/PostgreSQL/9.4/data/pg_log**
I'm trying to change the log directory path to
**/logs/demo/**
The server won't start when i uncomment the log path and it starts only when its default.
The postgresql.conf file looks like
# ERROR REPORTING AND LOGGING
#------------------------------------------------------------------------------
# - Where to Log -
log_destination = 'stderr' # Valid values are combinations of
# stderr, csvlog, syslog, and eventlog,
# This is used when logging to stderr:
logging_collector = on
# These are only used if logging_collector is on:
#log_directory = '/logs/etbos/demo/' #directorywherelogfiles are written
#log_filename = 'postgresql-%Y-%m-%d_%H%M%S.log' # log file name pattern,
# These are relevant when logging to syslog:
#syslog_facility = 'LOCAL0'
#syslog_ident = 'postgres'
# This is only relevant when logging to eventlog (win32):
#event_source = 'PostgreSQL'
So this is what I supposed :) You need to grant permissions to the new log directory to postgres user.
You can do this using f.e.:
sudo chown postgres:postgres /your/new/log/dir/path
Answering your other question:
To allow TCP/IP connections from remote hosts you need to edit pg_hba.conf file.
You can allow ALL TCP/IP connections by adding a line like this:
host all all 0.0.0.0/32 md5
There are five parameters above, you can read about them in the pg_hba.conf file in the comments at the top of the file, but in short they mean:
[connection_type] [database_name] [user_name] [remote_ip/mask] [auth_type]
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 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 <
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
I have apache virtualhost:
<VirtualHost IP_WAN:80>
ServerName test.localnet
DocumentRoot /srv/http/localnet/test/trunk/docroot
<Directory /srv/http/localnet/test/trunk/docroot>
Options Indexes
</Directory>
</VirtualHost>
The partition /srv is NFS3 mounted filesystem:
172.16.0.2:/srv /srv nfs nodev 0 0
at the server-side it's exported by:
/srv 172.16.0.0/255.255.255.240(rw,sync,no_subtree_check,no_root_squash)
directory /srv/http/localnet/test/trunk is absolute symlink to /srv/http/localnet/test/exports/trunk-v2
In the /srv/http/localnet/test/exports I have exported SVN trees (trunk-v1, trunk-v2, trunk-v3)
When I ask apache for http://test.localnet, it serves 200 OK and index from /srv/http/localnet/test/exports/trunk-v2/docroot
BUT:
If I remove symlink /srv/http/localnet/test/trunk and create a new one to another version (ln -s /srv/http/localnet/test/exports/trunk-v3 /srv/http/localnet/test/trunk), apache gives me 404 Not Found. It takes about seconds/minutes, then everything goes back to normal itself.
If I do ls -la /srv/http/localnet/test/trunk/ in this condition, it goes back to normal immediately. I think there's some problem with NFS cache, but I'm not able to find where exactly the problem occurs and how to prevent it. The symlink occupies the same inode as the previous one, both of targets (the old one and the new one) exists.
On the server side I have /srv partition mounted this way:
/dev/xvda7 on /srv type xfs (rw,nosuid,nodev)
I also use this parameters:
echo 262144 >/proc/sys/net/core/rmem_max
echo 262144 >/proc/sys/net/core/rmem_default
echo 262144 >/proc/sys/net/core/wmem_max
echo 262144 >/proc/sys/net/core/wmem_default
echo noop >/sys/block/xvda7/queue/scheduler
echo 0 >/sys/block/xvda7/queue/read_ahead_kb
I'm also trying to tune MTU of the network interface up to 9000, but without success.
Does anybody know, what's the problem? Why apache can't find the symlink until 'manually' refresh of the directory structure (ls)? Thanks a lot
Ondra
The solution seems to be:
http://publib.boulder.ibm.com/httpserv/manual70/mod/core.html#enablemmap
"With an NFS-mounted DocumentRoot, the httpd may crash due to a segmentation fault if a file is deleted or truncated while the httpd has it memory-mapped"
This is exactly the situation, when removing the symlink in the path to the page.
Hope it helps others :-)