Here's my code, placed inside the proftpd.conf file.
<Directory public_html>
GroupOwner ~
UserOwner www-data
Umask 002 002
</Directory>
however, when I upload a file for testing, the user is still [user] instead of www-data.
Probably, You didn't specify full path to public_html. Can you check this?
<Directory /full/path/to/public_html>
GroupOwner ~
UserOwner www-data
Umask 002 002
</Directory>
Related
I really don't get it how can i get to that backend .. How i installed the advanced template is like the way they show it in the official site : http://www.yiiframework.com/download/ . Everything step by step. When i try frontend.dev (in my case eshop) i am redirected to the front end part but when i try backend.dev(in my case eshop/admin) i am also redirected to the frontend.
This is my host file:
# Copyright (c) 1993-2009 Microsoft Corp.
#
# This is a sample HOSTS file used by Microsoft TCP/IP for Windows.
#
# This file contains the mappings of IP addresses to host names. Each
# entry should be kept on an individual line. The IP address should
# be placed in the first column followed by the corresponding host name.
# The IP address and the host name should be separated by at least one
# space.
#
# Additionally, comments (such as these) may be inserted on individual
# lines or following the machine name denoted by a '#' symbol.
#
# For example:
#
# 102.54.94.97 rhino.acme.com # source server
# 38.25.63.10 x.acme.com # x client host
# localhost name resolution is handled within DNS itself.
# 127.0.0.1 localhost
# ::1 localhost
# 127.0.0.1 modules
127.0.0.1 eshop
127.0.0.1 eshop/admin
0.0.0.1 mssplus.mcafee.com
And the vhost.conf:
<VirtualHost *:80>
ServerName eshop
DocumentRoot "C:/xampp/htdocs/eshop/frontend/web/"
<Directory "C:/xampp/htdocs/eshop/frontend/web/">
# use mod_rewrite for pretty URL support
RewriteEngine on
# If a directory or a file exists, use the request directly
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# Otherwise forward the request to index.php
RewriteRule . index.php
# use index.php as index file
DirectoryIndex index.php
# ...other settings...
# Apache 2.4
Require all granted
## Apache 2.2
# Order allow,deny
# Allow from all
</Directory>
</VirtualHost>
<VirtualHost *:80>
ServerName eshop/admin
DocumentRoot "C:/xampp/htdocs/eshop/backend/web/"
<Directory "C:/xampp/htdocs/eshop/backend/web/">
# use mod_rewrite for pretty URL support
RewriteEngine on
# If a directory or a file exists, use the request directly
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# Otherwise forward the request to index.php
RewriteRule . index.php
# use index.php as index file
DirectoryIndex index.php
# ...other settings...
# Apache 2.4
Require all granted
## Apache 2.2
# Order allow,deny
# Allow from all
</Directory>
</VirtualHost>
Where is my mistake ? A lot of thanks in advance!
Using a slash (/) in hostname is illegal, as it is defined in RFC 952. Therefore in the URL "http://eshop/admin" the server name is "eshop" and apache is using of course your first virtual server setting.
Summarized, your idea will never work. You should use eshop-admin as server name.
I am getting this error when I try executing a basic Perl script on my Apache server. In my browser, I type in localhost/cgi-bin/first.pl, and I receive this error:
(13)Permission denied: exec of '/usr/lib/cgi-bin/first.pl' failed
This is my perl script:
#!/usr/lib/cgi-bin
print "Content-type: text/html\n\n";
print "Hello, World.";
And this is my default file in the sites-available folder. As you can see, every file in /usr/lib/cgi-bin should be recognized as a CGI file. And, /usr/lib/cgi-bin is exactly where first.pl is located.
<VirtualHost *:80>
ServerAdmin webmaster#localhost
DocumentRoot /home/www
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /home/www/>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
</Directory>
ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
<Directory "/usr/lib/cgi-bin">
AddHandler cgi-script .cgi .py
AllowOverride None
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny
Allow from all
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn
CustomLog ${APACHE_LOG_DIR}/access.log combined
Alias /doc/ "/usr/share/doc/"
<Directory "/usr/share/doc/">
Options Indexes MultiViews FollowSymLinks
AllowOverride None
Order deny,allow
Deny from all
Allow from 127.0.0.0/255.0.0.0 ::1/128
</Directory>
ALSO, I did do chmod a+x first.pl.
You are getting this error because the shebang line (the first line of the script, starting with #!) specifies the interpreter that is launched to execute the script. What failed was therefore launching /usr/lib/cgi-bin as an executable.
Replace
#!/usr/lib/cgi-bin
with
#!/usr/bin/perl
If that still doesn't work, one possibility is that perl is in an ununsual location, and you could try
#!/usr/bin/env perl
One suggestion, if you can use a shell on the machine where your script lives, would be to try executing it directly. Had you done this, you would have seen a slightly more explanatory message "bad interpreter: Permission denied".
Check your permission/owner information on the directory as well.
Looking at the apache conf you posted, you will need to change the script to have a .cgi extension or add the perl extension to the AddHandler. What you have provided only lists the python extension.
I had this problem with the http/cgi wrapper for git.
For me the issue was mod_cgid and the permissions on /var/run preventing cgid from attaching to the socket used for the cgi script.
The rather cryptic clue was
[Fri Nov 27 14:39:02.506675 2020] [cgid:error] [pid 589971:tid 140310986311424] (13)Permission denied: [client 172.16.90.189:50018] AH01257: unable to connect to cgi daemon after multiple tries: /usr/lib/git-core/git-http-backend
Yet www-data can run the git-http-backend cgi executable
I resolved this by creating folder /apache_run with permissions www_data:www_data 770
and adding the following to apache2.conf
ScriptSock /apache2_run/cgid.sock
I am testing to deploy the tester example of Dancer using fcgi. But it just didn't work.
I keep getting the error message:
File does not exist: /home/tester/MyApp/public/dispatch.fcgi/
However, this app can run successfully with cgi. And I have made the changes to http.conf according to dancer's deployment manual.
Can someone pointing me to some solutions or possible reasons for this error?
below is the http.conf:
<VirtualHost *:80>
ServerName localhost
# /srv/www.example.com is the root of your
# dancer application
DocumentRoot /home/tester/MyApp/public
ServerAdmin you#example.com
<Directory "/home/tester/MyApp/public">
AllowOverride None
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny
Allow from all
AddHandler fastcgi-script .fcgi
</Directory>
ScriptAlias / /home/tester/MyApp/public/dispatch.fcgi/
ErrorLog /var/log/apache2/MyApp-error.log
CustomLog /var/log/apache2/MyApp-access_log common
</VirtualHost>
Thank you
I don't think that ScriptAlias is what you want to be using. From the documentation...
The ScriptAlias directive has the same behavior as the Alias
directive, except that in addition it marks the target directory as
containing CGI scripts that will be processed by mod_cgi's cgi-script
handler.
Basically Apache looks for a directory called '/home/tester/MyApp/public/dispatch.fcgi/' and every file in this dir is processed through mod_cgi. In this case it can't be found since it's a regular file.
Have you tried using mod_rewrite? My httpd config for Dancer is pretty much the same as yours except I'm using mod_rewrite
DocumentRoot /home/user/src/MyApp/public
<Directory "/home/user/src/MyApp/public">
AllowOverride None
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny
Allow from all
AddHandler fcgid-script .fcgi #using fcgid instead of fastcgi
</Directory>
RewriteEngine On
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_FILENAME} !-f
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /dispatch.fcgi$1 [QSA,L]
I have been tearing my hair out trying to get this working but no matter what I do I can't get .pl files to execute in the cgi-bin of my virtual directory. I have been searching for solutions for the past 4 hours and have tried everything I have come across, and nothing works for me. Perl files are executing perfectly for my default site, just not for my virtual host. The only mopdified file in my Apache2 configuration is the /etc/apache2/sites-available/default file, and currently it is as follows (except for the sitename):
<VirtualHost *:80>
ServerAdmin webmaster#localhost
DocumentRoot /var/www
<Directory />
Options FollowSymLinks
AllowOverride All
</Directory>
<Directory /var/www/>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
<Directory /var/www/cgi-bin>
Options +ExecCGI
AllowOverride All
AddHandler cgi-script cgi pl
Order allow,deny
allow from all
</Directory>
# ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
# <Directory "/usr/lib/cgi-bin">
# AllowOverride All
# Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
# Order allow,deny
# Allow from all
# </Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn
CustomLog ${APACHE_LOG_DIR}/access.log combined
Alias /doc/ "/usr/share/doc/"
<Directory "/usr/share/doc/">
Options Indexes MultiViews FollowSymLinks
AllowOverride None
Order deny,allow
Deny from all
Allow from 127.0.0.0/255.0.0.0 ::1/128
</Directory>
</VirtualHost>
<VirtualHost *:80>
ServerAlias subdom.mysite.com
DocumentRoot /var/www/subdom
<Directory /var/www/subdom/cgi-bin>
Options +ExecCGI
AllowOverride All
AddHandler cgi-script cgi pl
Order allow,deny
allow from all
</Directory>
</VirtualHost>
Any and all help is very much appreciated.
I think it is a typo: You need a period before pl.
AddHandler cgi-script .cgi .pl
Also check this: How do I configure Apache 2 to run Perl CGI scripts?
This sounds and looks familiar:
In my case, I made a mistake with my ScriptAlias directive. I uncommented the original one, but forgot to configure a new one.
As soon as I correctly changed and saved my sites-available/default config file from this:
ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
<Directory "/usr/lib/cgi-bin">
.. to this:
ScriptAlias /cgi-bin/ /var/www/cgi-bin/
<Directory "/var/www/cgi-bin">
.. and reloaded apache2, it just worked: it stopped displaying my scripts as text, and started running them as a script. Also, it no longer displayed /var/www/cgi-bin as a directory in the browser, but now correctly displays the error:
Forbidden
You don't have permission to access /cgi-bin/ on this server.
That is from the apache error_log:
[Mon Oct 17 17:55:42 2011] [error] [client 127.0.0.1] (13)Permission denied: access to /index.html denied
In /etc/apache2/vhosts.d I've created this file:
<VirtualHost 127.0.0.1:3000>
DocumentRoot "/home/mm/lib/vokabeltrainer"
ServerName localhost:3000
<Directory "/home/mm/lib/vokabeltrainer">
Options FollowSymLinks ExecCGI
AddHandler cgi-script .pl
IndexIgnore *
RewriteEngine on
RewriteCond %{DOCUMENT_ROOT}/public/%{REQUEST_URI} -f
RewriteRule ^(.*) public/$1 [L]
RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_URI} !-f
RewriteRule ^(.*) vokabeltrainer.pl [L]
AllowOverride None
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
The /etc/apache2/listen.conf looks like this:
Listen 127.0.0.1:3000
NameVirtualHost 127.0.0.1:3000
For testing, I've modified the folder like chmod -R 0777 /home/mm/lib/vokabeltrainer
When I run the vokabeltrainer.pl (Mojolicious::Lite script) with morbo development server it works.
Has somebody a clue where I should look?
As Ikegami pointed out, my first problem was that I didn't consider the /home/mm/lib part of the path: the lib-directory didn't have enough rights so I had to ad the needed rights.
Then I changed the path in the shebang form /usr/local/bin/perl to /usr/bin/perl and installed Mojolicious::Lite for the /usr/bin/perl.
The last thing I had to do, was writing the url like this http://localhost:3000/vokabeltrainer.pl/random instead of http://localhost:3000/random.
(In the Pretty "Web 2.0" URLs at mojo/wiki/Apache-deployment is shown a way to keep the short url)