I'm trying to run a Yii based website on my localhost. I am using apache2 on an ubuntu 12.04 machine.
It works till localhost/website/ and displays the directories in that folder:
framework/
frontend/
support/
www/
To run the website however, I must use www/ and the moment I click on www/ it says Server Error.
To fix this, I've changed all permissions in my var/www/website as
sudo chmod -R 755 website
sudo chown -R website
sudo chgrp -R www-data website
As a last resort, I used chmod -R 777 website.
Still doesn't work. I think it may be a problem with Yii installed on my machine itself, but the demos in the Yii folder are working properly.
Are 'support' and 'frontend' your apps? Moving your app into the www folder is an option, but you will need to correct the path in the index.php entry script to reach the framework. Another option is to use .htaccess rules to point to your app folders. I'm not experienced enough with .htaccess to help you there, however.
Related
I just install gitlist to follow my git repos and I get that page when I launch localhost/gitlist:
get('date', 'timezone')) { date_default_timezone_set($config->get('date', 'timezone')); } $app = require 'boot.php'; $app->run();
I can't solve the problem. Can someone give me a hand about that?
I had the same issue. I was able to solve it this way:
1- Be sure you have php7 correctly installed and with the apache2 module properly enabled/configured. I use ubuntu, for me it was enough with:
sudo apt-get -y install php7.0 libapache2-mod-php7.0
2- Be sure your gitlist folder has the right permisions for the web user. I use apache2(.4):
sudo chown -R www-data:www-data <path-to-gitlist>
3- Also check in your gitlist config.ini file that you are pointing to the folder containing the git repos, not to the git repos:
repositories[]= '/home/user/repositories'
4- Restart the apache service:
systemctl restart apache2
I hope this helps.
for a while now I have been attempting to edit the index.html file that is created when you install apache2 / php5 / liapache2 ect. The command I used to install it was:
sudo apt-get install apache2 php5 libapache2-mod-php5
But whenever I try to save my edited version of the index.html, file it comes up with access denied. Furthermore if I try to edit it in nano nothing comes up
these are the commands I used :
cd /var/www/
sudo nano index.html
Any suggestions?
it would mean a lot to me if someone answered this question
Thanks
This is what it says in the Apache documentation from raspberrypi.org:
By default the html directory and index.html file are both owned by the root user. Setting up an Apache web server on a Raspberry Pi
What worked for me is that I changed the owner from root to pi for /www/ and /html/ with this commands:
sudo chown pi: .
sudo chown pi: ..
But note that I'm also just using the Apache server for an local installation and I don't care about security at this point. I don't know how secure this solution is.
Change the permissions of the entire folder
sudo chmod 755 -R /var/www/html
I'm running the LAMPP stack on Ubuntu and I want to reset my Apache config files to a fresh default template. How can I do this?
Also, when editing the file /etc/apache2/site-available/000-default, should I also modify /etc/apache2/sites-enabled/default and /etc/apache2/sites-enabled/default-ssl?
Reinstalling Apache would be the easiest thing to do if it's a real mess:
$ sudo apt-get install --reinstall apache2
But if you just need specific files then you can extract them from the Apache .deb file for your Ubuntu version.
Regarding the editing of multiple files, no - the files in /etc/apache2/sites-enabled/ are symlinks created when you enable a site using a2ensite. For example, you have the Virtual Host www.example.com defined in the file /etc/apache2/sites-available/www.example.com:
$ cd /etc/apache2/sites-available
$ sudo a2ensite www.example.com
$ cd ../sites-enabled
$ ls -la
www.example.com -> ../sites-available/www.example.com
Then reload Apache to make the VHost www.example.com visible:
$ sudo service apache2 reload
To make changes to www.example.com just edit the file /etc/apache2/sites-available/www.example.com. Then:
$ sudo service apache2 reload
To make the changes live. Anything that Apache finds in the sites-enabled directory is loaded into it's configuration on start up.
All of the sudden I started getting 404s for files like http://example.localhost/javascript/jquery.min.js
Earlier everything was working just fine. I didn't change any configs, at least not manually.
But now if I'd try to access the /javascript directory itself I would get "Cannot serve directory /usr/share/javascript/: No matching DirectoryIndex (index.html,index.cgi,index.pl,index.php,index.xhtml,index.htm) found, and server-generated directory index forbidden by Options directive in the Apache error log.
I was trying to find solution to this on Stack Overflow, but I couldn't. So I'm just leaving this here if anyone happens to encounter the same problem.
So why the hell would it look in the /usr/share/javascript instead of what I had configured in the VirtualHost. To figure that out I did something like the following:
$ cd /etc/apache2
$ grep -R Alias * | grep share
...
conf-enabled/javascript-common.conf:Alias /javascript /usr/share/javascript/
...
After googling for that configuration file name I found some explanation.
I don't know why, but I had the javascript-common package installed.
It doesn't seem harmful to get rid of it, so doing $ sudo apt-get purge javascript-common solved the problem for me.
You don't need to edit the conf file or purge the package just disable it.
a2disconf javascript-common
service apache2 reload
If for some reason you want to use that conf:
a2enconf javascript-common
service apache2 reload
The issue:
Web applications that use JavaScript need to distribute it through
HTTP. Using a common path for every script avoids the need to enable
this path in the HTTP server for every package.
This is the package that creates /usr/share/javascript alias and enables it in the Apache webserver.
Recommended fix
And that's it. You won't have any other problem with javascript directories. Another fix could be to rename /usr/share/javascript/ to /usr/share/javascript-common/, then adjust the Alias in javascript-common.conf to point to the renamed directory. I am still not sure if this will affect any future update.
Another Fix:
Go to /etc/apache2/conf-available/javascript-common.conf. You will find this:
Alias /javascript /usr/share/javascript/
<Directory "/usr/share/javascript/">
Options FollowSymLinks MultiViews
</Directory>
So you just have to comment these lines (with the # char) (it is not recommended to edit the file directly in conf-enabled) to avoid the forbidden error. After that, do this:
a2disconf javascript-common
a2enconf javascript-common
I'm on a Debian machine, and there is no a2disconf command. I found the /etc/apache2/conf.d directory is a link to /etc/javascript-common/javascript-common.conf.
I went and edited that file (as root) and changed it to alias /javascript-common instead of /javascript by changing the top line to
Alias /javascript-common /usr/share/javascript/
and saving it and restarting Apache.
I just had a similar problem on an Ubuntu system. Apparently the javascript-common package was hosed at some point in time and the configure script wouldn't run properly. Removing javascript-common and reinstalling with apt-get would not fix it. I had to:
dpkg --purge javascript-common
apt-get install javascript-common
And that seemed to fix the problem. This is an Ubuntu 16.04 LTS (Xenial Xerus) system that was upgraded from Ubuntu 14.04 LTS (Trusty Tahr).
Uninstall apache2 and delete these folders:
rm -R /var/www/html/
rm -R /etc/apache2
Then reinstall javascript-common and apache2.
I have gone through many tutorials for installing tomcat in my Ubuntu system. I installed tomcat7. tomcat7-admin, tomcat7-examples and tomcat7-docs by following commands:
apt-get install tomcat7
apt-get install tomcat7-admin
apt-get install tomcat7-docs
apt-get install tomcat7-examples
After this setup I can start, stop the server by:
/etc/init.d/tomcat7 start/stop
I have following files and folders:
/usr/share/tomcat7/
/etc/tomcat7/
/var/lib/tomcat7/
I have added the following user in tomcat-users.xml file under /usr/sharetomcat7/conf/tomcat-users.xml and /etc/tomcat7/tomcat-users.xml
<user username="admin" password="amdin" roles="admin-gui,standard,manager-gui"/>
Now when I open localhost:8080, I get a dull page saying 'It works' unlike the colorful page we get generally. These are the contents of page:
You might consider installing the following packages, if you haven't already done so:
tomcat7-docs: This package installs a web application that allows to browse the Tomcat 7 documentation locally. Once installed, you can access it by clicking here.
tomcat7-examples: This package installs a web application that allows to access the Tomcat 7 Servlet and JSP examples. Once installed, you can access it by clicking here.
tomcat7-admin: This package installs two web applications that can help managing this Tomcat instance. Once installed, you can access the manager webapp and the host-manager webapp.
But when I click on 'click here' link above to open admin, docs or examples I get "HTTP status 404: The requested resource is not available."
But I have installed admin, examples and docs. I am not getting it. Please help! I am using Ubuntu 13.04
on ubuntu 14.04 it worked for me using following command :
sudo apt-get install tomcat7-docs tomcat7-admin tomcat7-examples
Create a link for each application in webapps folder as below:
cd /var/lib/tomcat7/webapps
sudo ln -s /usr/share/tomcat7-examples/examples examples
sudo ln -s /usr/share/tomcat7-docs/docs docs
sudo ln -s /usr/share/tomcat7-admin/manager manager
sudo ln -s /usr/share/tomcat7-admin/host-manager host-manager