Recently, I downloaded and installed mooshak in Ubuntu 14.04. I followed all the steps given in the requirements and installation page.
When I try to access http://localhost/~mooshak, I'm being redirected to http://localhost/~mooshak/cgi-bin/execute and the following content is being displayed :
#!/bin/sh
# the next line restarts using tclsh \
PATH=$PATH:/usr/local/bin:/usr/contrib/bin ; exec tclsh "$0" "$#"
#-*-Mode: TCL; iso-accents-mode: t;-*-
cd ../..
lappend auto_path packages
source .config
execute::command_line
Can anyone point me in the right direction? This is the content of my /etc/apache2/mods-enabled/userdir.conf file :
<IfModule mod_userdir.c>
UserDir public_html
UserDir disabled root
<Directory /home/*/public_html>
AllowOverride FileInfo AuthConfig Limit Indexes
Options MultiViews Indexes SymLinksIfOwnerMatch IncludesNoExec
<Limit GET POST OPTIONS>
Require all granted
</Limit>
<LimitExcept GET POST OPTIONS>
Require all denied
</LimitExcept>
</Directory>
<Directory /home/*/public_html/cgi-bin>
Options +ExecCGI -Includes -Indexes
SetHandler cgi-script
Order allow,deny
Allow from all
</Directory>
</IfModule>
Thanks in advance!
Make sure you have the modules userdir and suexec are enabled in Apache2. If needed execute the following commands
cd /etc/apache2/mods-enabled
sudo ln -s ../mods-available/userdir.conf
sudo ln -s ../mods-available/userdir.load
sudo ln -s ../mods-available/suexec.load
You will need to restart Apache to activate the configuration.
sudo apache2ctl graceful
Related
Running a project in dev server run perfectly but I try to move on a live server, I got "The requested URL /icons/create was not found on this server."
i got that just in 1 route in : .../icon/create
but any route works fine.
this is my htaccess :
I try to composer dump-autoload in local but don't get any error"
or something problem in my htaccess file?
mod_rewrite already enable in the apache web server.
Very thank you, if someone wants to help me :)
as u r saying u have "mod_rewrite already enable"
try this editing /etc/apache2/sites-enabled/000-default or /etc/apache2/apache2.conf
<Directory /var/www/>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
</Directory>
Change the AllowOverride None to AllowOverride All
Comment Alias in /etc/apache2/mods-available/alias.conf.
<IfModule alias_module>
# Aliases: Add here as many aliases as you need (with no limit). The format is
# Alias fakename realname
#
# Note that if you include a trailing / on fakename then the server will
# require it to be present in the URL. So "/icons" isn't aliased in this
# example, only "/icons/". If the fakename is slash-terminated, then the
# realname must also be slash terminated, and if the fakename omits the
# trailing slash, the realname must also omit it.
#
# We include the /icons/ alias for FancyIndexed directory listings. If
# you do not use FancyIndexing, you may comment this out.
# Alias /icons/ "/usr/share/apache2/icons/"
# <Directory "/usr/share/apache2/icons">
# Options FollowSymlinks
# AllowOverride None
# Require all granted
# </Directory>
</IfModule>
After Comment these lines check apache conf using this command:
sudo apache2ctl -t
Then reload apache2:
sudo systemctl reload apache2
I have a simple bash script which should generate Apache site.conf file and then run a2ensite site.name
Everything works fine but a2ensite does not generate log files automatically. Then when I run sudo systemctl reload apache2 it throws me an error Cannot access directory '/var/log/apache2/www/site.name/' Bash file looks like:
#!/bin/bash
read -p 'Write url without www and http prefixes: ' url
template=$(</home/Camo/custom-scripts/apache/site-template.conf)
# Next line is string substitution
template=("${template//__URL__/$url}")
configFile=${url}'.conf'
configDirPath="/etc/apache2/sites-available/"
wwwDirPath="/var/www/html/$url"
mkdir $wwwDirPath
chown -R www-data:www-data $wwwDirPath
chmod 644 -R $wwwDirPath
echo "$template" > $configDirPath$configFile
sudo a2ensite ${configFile}
sudo systemctl reload apache2
and here is site.cong file created by previous script
<VirtualHost *:80>
ServerAdmin xxxxx.xxxxx#gmail.com
ServerName camo.publicvm.com
ErrorLog ${APACHE_LOG_DIR}/www/camo.publicvm.com/error.log
CustomLog ${APACHE_LOG_DIR}/www/camo.publicvm.com/access.log combined
DocumentRoot /var/www/html/camo.publicvm.com
<Directory /var/www/html/camo.publicvm.com/>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
Require all granted
</Directory>
</VirtualHost>
everything looks ok so why are log files missing? Thanks for any help.
Log files are not generated automatically, so you will have to create them manually:
touch ${APACHE_LOG_DIR}/www/camo.publicvm.com/error.log
touch ${APACHE_LOG_DIR}/www/camo.publicvm.com/access.log
And don't forget changing its ownership:
chown root.adm ${APACHE_LOG_DIR}/www/camo.publicvm.com/error.log
chown root.adm ${APACHE_LOG_DIR}/www/camo.publicvm.com/access.log
Then check if everything looks fine and if it does, reload apache2 service:
apachectl configtest
systemctl reload apache2
working on my auto-install script. It isn't using my variable properly, debug log looks like this.
I've tried several variants, using "" instead of '', not using '' or "" but just $variable. The script looks like this:
echo "Creating Apache2 VHost and Wordpress blog $domain"
VAR1=$sitealias
VAR2=$domain
MOREF=$`pwgen 14 1`
echo $MOREF is SQL password.
mkdir /var/www/"$domain"
chown -R www-data:www-data /var/www/"$domain"
echo "<VirtualHost *:80>
ServerName myblog.example.com
ServerAdmin webmaster#example.com
DocumentRoot /usr/share/wordpress
Alias /wp-content /var/lib/wordpress/wp-content
<Directory /usr/share/wordpress>
Options FollowSymLinks
AllowOverride Limit Options FileInfo
DirectoryIndex index.php
Require all granted
</Directory>
<Directory /var/lib/wordpress/wp-content>
Options FollowSymLinks
Require all granted
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
" > /etc/apache2/sites-available/$domain.conf
mysqladmin -u root password supersecretpassword create wp_$sitealias
mysqladmin -u root password supersecretpassword CREATE USER $sitealias#'localhost' IDENTIFIED BY '$MOREF';
mysqladmin -u root password supersecretpassword GRANT ALL PRIVILEGES ON wp_'$sitealias.'* TO '$sitealias'#localhost;
FLUSH PRIVILEGES;
quit
The script should insert the variable in the commands, folder directories. Instead the variable is just ignored, as is shown in the debug log.
UPDATE:
variable capturing works fine now. However, SQL doesn't like your double quote (copy and pasted them)
root#hosting:/bin# hello.sh letstest.tld testtesttdjsuqwu
Creating Apache2 VHost and Wordpress blog
qui2AenaihoQu9 is SQL password.
mysqladmin: Unknown command: 'create wp_testtesttdjsuqwu'
mysqladmin: Unknown command: 'CREATE USER 'testtesttdjsuqwu'#'localhost' IDENTIFIED BY 'q'
mysqladmin: Unknown command: 'GRANT ALL PRIVILEGES ON wp_testtesttdjsuqwu.* TO 'testtesttd'
/bin/hello.sh: line 37: FLUSH: command not found
/bin/hello.sh: line 38: quit: command not found
If you want to use parameters inside your script (based on the comments above, 'domain' and 'sitealias') use the '$1' '$2' to capture them
domain=$1
sitealias=$2
# Fixed quoting of pwgen)
MOREF=$(pwgen 14 1)
# Rest of the script here, using $domain, $sitealias
echo $MOREF is SQL password.
mkdir /var/www/"$domain"
It's not completely clear what value do you want to 'APACHE_LOG_DIR'. Assuming that this variable need to be resolved at run-time, based on the Apache default value, you want to use single quote instead of double quote for the 'echo' statement. This will defer the resolution of this variable.
echo '<VirtualHost *:80>
ServerName myblog.example.com
ServerAdmin webmaster#example.com
DocumentRoot /usr/share/wordpress
# Lines removed for
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
' > /etc/apache2/sites-available/$domain.conf
Also, consider double-quoting for the mysqladmin setup command. Use double quote to enable variable substitution, Use single quote when needed by mysql.
mysqladmin -u root password supersecretpassword "create wp_$sitealias"
mysqladmin -u root password supersecretpassword "CREATE USER '$sitealias'#'localhost' IDENTIFIED BY '$MOREF'";
mysqladmin -u root password supersecretpassword "GRANT ALL PRIVILEGES ON wp_$sitealias.* TO '$sitealias'#'localhost';"
FLUSH PRIVILEGES;
quit
i'm trying to execute .cgi file on my server but return the following error
403 Forbidden
You don't have permission to access /run/test.cgi on this server.
Apache/2.0.64 (Win32) Server at localhost Port 80
server conf:
windows 7
apache 2
activeperl
i tried various solutions but none working
Set the permissions on /run/test.cgi to readable and executable > not working
tried to change Options indexes > not working
<Directory "E:/Apache/Apache2/htdocs">
# Options Indexes FollowSymLinks Includes ExecCGI
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
AllowOverride None
Order allow,deny
Allow from all
</Directory>
my directory is under "E:/Apache/Apache2/htdocs/run/test.cgi"
the script:
#!/usr/bin/perl
print "Content-type: text/plain\n\n";
print "testing...\n";
use CGI;
use CGI::Carp 'fatalsToBrowser';
#print qq`Perl_version: $]\n`;
#print qq`CGI::VERSION: $CGI::VERSION\n`;
foreach my $var (sort keys %ENV)
{
# print "$var: $ENV{$var}\n";
}
#print "\nExecuting 'which convert':\n";
#print "\n";
#print "\nExecuting 'find / -name convert':\n";
#print `find / -name convert`;
can anyone help?
thanks
I'm trying to get two Ruby apps to work from the same port. I don't know server technology at all, so forgive my ignorance. I've tried to follow this doc:
http://www.modrails.com/documentation/Users%20guide%20Apache.html
sections 4.1 - 4.3, but I keep messing something up. I've tried to simplify a little, so here is my situation. I have two simple rackup apps here:
/Users/dan/webapps/test1
/Users/dan/webapps/test2
They each have the "config.ru" file, the public/ folder, and the tmp/ folder with "restart.txt", as directed. They both work on their own.
I have the following in my httpd.conf file:
<VirtualHost *:80>
ServerName localhost
DocumentRoot /Users/dan/webapps
<Directory /Users/dan/webapps>
Allow from all
</Directory>
RackBaseURI /test1
<Directory /Users/dan/webapps/test1>
Options -MultiViews
</Directory>
RackBaseURI /test2
<Directory /Users/dan/webapps/test2>
Options -MultiViews
</Directory>
</VirtualHost>
I start apache, and then put this in my browser: http://localhost/test1. I get:
Forbidden
You don't have permission to access /test1 on this server.
I'm not surprised it doesn't work, because I am supposed to set up a symlink but I don't know how to apply that to my setup. Here is the example from the doc:
ln -s /webapps/rackapp/public /websites/phusion/rack
Can you tell me how to set up the symlinks, and let me know if you see anything else wrong? Please give the "for dummies" answer, this stuff boggles my mind. Thanks!
To create the symlinks, try this:
ln-s /Users/dan/webapps/test1 /Users/dan/webapps/test1/public
ln-s /Users/dan/webapps/test2 /Users/dan/webapps/test2/public
However, as chris polzer mentioned, you should also check that your apache user can read from those directories.
If you don't know how to do that, then post the output of these commands:
ls -l /Users/dan/webapps/test1
ls -l /Users/dan/webapps/test2.
ps -aux | grep http
ps -aux | grep apache
You may also need to check the permissions of all parent directories. I.e. /Users, /Users/dan, and /Users/dan/webapps. See: http://www.modrails.com/documentation/Users%20guide%20Apache.html#_deploying_to_a_virtual_host_8217_s_root_2
phylae, I think you may have the paths reversed in the symbolic link. To get it working, I changed the link names for clarity:
<VirtualHost *:80>
ServerName localhost
DocumentRoot /Users/dan/webapps
<Directory /Users/dan/webapps>
Allow from all
</Directory>
RackBaseURI /test1link
<Directory /Users/dan/webapps/test1>
Options -MultiViews
</Directory>
RackBaseURI /test2link
<Directory /Users/dan/webapps/test2>
Options -MultiViews
</Directory>
</VirtualHost>
and then, the symbolic links:
ln -s /Users/dan/webapps/test1/public /Users/dan/webapps/test1link
ln -s /Users/dan/webapps/test2/public /Users/dan/webapps/test2link
Then these urls work as expected in a browser.
http://localhost/
http://localhost/test1link
http://localhost/test2link