I've installed postgres for moodle and I got the following instructions:
Apache/mod_php setup
Give full access to the project directory to the process running
apache. You might also have to set the x-flag on all .php files.
$ chmod -R a+rw * Create a 'moodle.vhost.conf' from moodle.vhost.conf.example in project directory. * Create a symlink
from /usr/local/var/moodle to the project directory.
$ cd /usr/local/var; ln -s moodle * Also symlink the new virtual host into apache config dir.
$ cd /private/etc/apache2/other
$ sudo ln -s /moodle.vhost.conf moodle.conf
$ sudo apachectl restart * Create your own custom /etc/vcmoodle/config_local.php file for things local to your
environment by copying, and modifying if required, the example file.
$ sudo mkdir -p /etc/vcmoodle
$ sudo cp /config_local.php.example /etc/vcmoodle/config_local.php
Still it won't work. When I look at my apache root then it comes just the standard apache page and no moodle. I've this sites-available
:/etc/apache2/sites-available$ ls
000-default.conf default-ssl.conf moodle.conf
and the file moodle.conf contents
<VirtualHost *:80>
DocumentRoot "/usr/local/var/moodle"
ServerName moodle.localdev.kth.se
ErrorLog /usr/local/var/moodle/error_log
LogLevel debug
<Directory "/usr/local/var/moodle">
AllowOverride all
Order allow,deny
Allow from 127.0.0.1
</Directory>
</VirtualHost>
But I don't get a moodle page at my web server. What am I doing wrong?
if youre running Ubuntu (judging by the tag), you need to put your project directory inside /var/www. Apache cant access project folders inside your specified directory unless you change the users/groups etc.
what youve tried is the normal apache default location for web folders, but Ubuntu like to change things.
Related
I have my own digitalocean droplet setup and followed this tutorial to a T to get Cakephp working
Setup CakePHP with LAMP Stack
Everything works exactly as written in that tutorial besides for 'Step 6' - Creating the Article user interface. (Books in my case)
After using the bake all command and navigating to `/books' I get a 404 not found
As you can see CakePHP is setup and working at the top level URL, however when trying to move past that to a Controller that definitely exists it can't find it.
After some more digging, I found the issue. Apparently mod_rewrite is turned off by default on Ubuntu
`sudo a2enmod rewrite
systemctl reload apache`
is the solution here
Make sure your rewrite mod is On
If you are using Linux goto /etc/apache2/sites-enabled -> open 000-default.conf file
<VirtualHost *:80>
....
// add these lines
<Directory /var/www/html>
#Options FollowSymLinks
Options Indexes FollowSymLinks Includes ExecCGI
AllowOverride All
Order deny,allow
Allow from all
</Directory>
....
<</VirtualHost>
Save it.
restart your server: sudo service apache2 restart
give your project permissions by giving this command:
sudo chown -R user_name:www-data project_name/
sudo chmod -R 755 project_name/
cd project_name
chown -R www-data tmp
chown -R www-data logs
chmod -R 777 tmp
chmod -R 777 logs
I want to host my laravel 5.2 project on apache tomcat server.
I have tried to host my laravel application on tomcat, but my routes are not working, getting 404 not found.
Please follow following steps:
Copy your Laravel Project's root folder to /var/www/html, or clone your
project on this path
Run composer install (You must have composer installed already)
Copy .env file from local environment to you server on project's root directory
Run php artisan key:generate
run chmod -R /var/www/html/{project_dir}/storage
run chmod -R /var/www/html/{project_dir}/bootstrap
run cd /etc/apache2/sites-available
Here you will find nano 000-default.conf file. Open it & change DocumentRoot options like DocumentRoot /var/www/html/{project_dir}/public and save it
Next, Find the apache2.conf located in /etc/apache2
Search for following lines in <Directory />:
Options Indexes FollowSymLinks
AllowOverride All
Require all denied
Change it to this:
Options Indexes FollowSymLinks Includes ExecCGI
AllowOverride All
Require all granted
run sudo a2enmod rewrite
run sudo service apache2 restart
I have installed LAMP (Linux, Apache2, MySQL, and PHP) stack.
I have a project directory named 'mahasiswa'. When i ran it on Windows 8 was working well (using XAMPP). Then, when i run it on my Ubuntu 16.04 LTS inside var/www/html/ is not working anymore.
The screen shot of the result :
Is there special configuration to run CodeIgniter project on Ubuntu 16.04 LTS ?
:: Any help would be much appreciate. Thank you.
EDIT
My configuration files :
etc/apache2/sites-available/000-default.conf
etc/apache2/sites-available/mahasiswa.conf
etc/hosts
mahasiswa/.htaccess
The current result on browser:
I don't know exactly what i've missing at this configuration. I've followed #eeya instruction / answer below. Any body can help me, please :D
For your question in setting up the apache virtual host configuration: Here's how it goes. If you have [root] privilege, Open your [Terminal] and go to this directory: /etc/apache2/sites-available
Then create a new virtual host configuration, For now, we will name this configuration the name of your project.
sudo vim mahasiswa.conf or sudo nano mahasiswa.conf
<VirtualHost *:80>
ServerName local.mahasiswa.com
DocumentRoot /var/www/html/mahasiswa
<Directory /var/www/html/mahasiswa/>
AllowOverride All
Require all granted
Allow from all
</Directory>
</VirtualHost>
1) ServerName: serves as the the DNS (Think of it as another server name aside from http://localhost or http://127.0.0.1)
2) DocumentRoot: from the word itself, is your [project]'s directory (e.g /var/www/html/mahasiswa)
3) Directory: are used to enclose a group of directives that will apply only to the named directory, sub-directories of that directory, and the files within the respective directories. In this case, we wanted to place control access rights to a directory:
AllowOverride All (This can be either All or None)
Require all granted
Allow from all
You can learn more of this here: http://httpd.apache.org/docs/current/mod/core.html#directory
Going back, Once you've saved this new configuration, Go to your /etc/hosts (hosts file) (e.g sudo vim /etc/hosts) and add the ff:
127.0.0.1 localhost local.mahasiswa.com
Once you've saved these changes on your [hosts] file, Execute this command:
sudo a2ensite mahasiswa.conf
sudo a2enmod rewrite
This will now [enable] your new site configuration and enable the [url rewrite] module as well. Then execute this afterwards:
sudo service apache2 reload
From the command itself, it means you need to reload [apache2] thus the configuration takes affect afterwards.
Then try to access your new domain name: local.mahasiswa.com.
You should be able to see your CI pages you've needed.
For further reference, check [Digital Ocean] guide here: https://www.digitalocean.com/community/tutorials/how-to-set-up-apache-virtual-hosts-on-ubuntu-16-04
Hope this helps for your case.
Edit:
In naming the [controller] file(s) (e.g mahasiswa), You might need to set [UpperCase] instead of [lowercase] format to (e.g Mahasiswa)
Enable mod_rewrite
sudo a2enmod rewrite
sudo systemctl restart apache2
I started to develop a project with laravel. I installed it using this link how-to-install-laravel-on-ubuntu-lamp.
I installed composer successfully, and using this command : sudo composer create-project laravel/laravel /home/egz-pc/laravel-project I created new project named laravel-project then a changed permissions using chmod 777 command.I restart apache and execute my project.
My problem is that when I type in browser: http://localhost/laravel-project I'm getting an error: The requested URL /laravel-project was not found on this server. If I create a project in /var/www/html on my local host I have no problems, and that error does not appear. What can I do?
The Apache server is installed on var/www/html.This is the default root directory of apache.
Either change the root directory of Apache or move the project to var/www/html.
To change Apache's root directory,
Run
cd /etc/apache2/sites-available
Then open the 000-default.conf file using the command
nano 000-default.conf
Edit the DocumentRoot
Then restart the apache server
sudo service apache2 restart
If you get "Forbidden You don't have permission to access / on this server" after changing the root of apache then do follow these steps
1.Find the apache2.conf located in etc/apache2 and open it using
nano apache2.conf
2.Use ctrl+w and search for Directory (It should be in line 153)
3.It should look like this
<Directory />
Options Indexes FollowSymLinks
AllowOverride All
Require all denied
</Directory>
4.Change it to
<Directory />
Options Indexes FollowSymLinks Includes ExecCGI
AllowOverride All
Require all granted
</Directory>
5.Restart apache2 and it should work.
EDIT:
I have made a script that lets you change Apache root directory in 1 command.
Link: Script for Apache
I an trying to get my Laravel site running on Digital Ocean. My laravel app is static so no SQL is used and I developed it locally with Homestead.
I can get the site showing the home page on IPaddress /public. It won't link to any pages though. I am guessing it is some rewrite problem I am having. I want to get rid of the /public and get it linking to other pages. Then worry about making it work on a domain
I followed PHPAcademys Cloud Server Set-up tutorial https://www.youtube.com/watch?v=1-ok9d_6xrc
The only difference is I used UBUNTU 14.04 x64. While following the tutorial I found I had a html folder inside /var/www. I needed to put my app within the html folder.
Code setup
sudo apt-get update
sudo apt-get install apache 2
sudo apt-get install php5 libapache2-mod-php5 php5-mcrypt
I didnt use mysql because i dont need it for this app. Its a static site with laravel.
It said mcrypt was needed so I used
sudo php5enmod mcrypt
sudo service apache2 restart
Then I was getting an exception handler error, so i fixed that with
chgrp -R www-data /var/www/html
chmod -R 775 /var/www/html/app/storage
You need to setup an apache2 virtual host
cd /etc/apache2/sites-available
sudo nano myapp.conf
<VirtualHost *:80>
ServerName myapp.com
ServerAlias www.myapp.com
DocumentRoot "/var/www/html/myapp/public"
<Directory "/var/www/html/myapp/public/">
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
exit nano
sudo a2ensite myapp.conf
sudo service apache2 restart
First go to your virtual host file which can be found on
/etc/apache2/sites-available/default.conf
I am not very sure about the path because I have been using nginx for so long. Anyways locate the conf file and change your root directory to something like
/var/www/html/public
rest all looks fine to me if that doesn't work chmod 777 app/storage