I am try to run Laravel app in Ubuntu 16.04 Apache server.
It is show server error as fallows
This page isn’t working
localhost is currently unable to handle this request.
HTTP ERROR 500
but i run it on development artisan server using below command and its working.
php artisan serve --host=192.168.2.103 --port=8050
pls can you explain what i have done wrong way in Apache server and how to do it correctly.
STEP 1
cd /etc/apache2/sites-available/
STEP 2
sudo cp 000-default.conf yourprojectName.conf
STEP 3
sudo vi yourprojectName.conf(you should know vi editor command)
STEP 4
Update below code
ServerName siteexample.co.in
DocumentRoot /var/www/project/public
<Directory /var/www/project/public>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order Allow,Deny
Allow from all
</Directory>
colse the editor
STEP 5
sudo a2ensite yourprojectName.conf
STEP 6
sudo service apache2 restart
Now will work
Congratulations!
Related
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
Just now I have start with zend framework, I have succesfully install zend framework, I followed the quick start guide I am stuck with doc root.
Short description of what I have done
1) Install lamp and zend framework
2) cd /var/www
3) zf create project quickstart
4) cd quickstart/library/
5) ln -s /usr/share/php/libzend-framework-php/Zend .
6) vi /etc/apache2/apache2.conf
<VirtualHost *:80>
ServerName zend.gworks.mobi
DocumentRoot /var/www/quickstart/public
SetEnv APPLICATION_ENV "development"
<Directory /var/www/quickstart/public>
DirectoryIndex index.php
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
note: also I tried with /etc/apache2/sites-enabled/000-default.conf but no luck
7) service apache2 restart
But still my browser point /var/www/html/index.html not /var/www/quickstart/public/index.php, I'm out of ideas. can anyone help me what I miss?
Solution (update)
I did right. when I restart vagrant, document root problem got solved, I don't know why it is not work previosly. but it throws .htaccess: Invalid command 'RewriteEngine' then I run this command sudo a2enmod rewrite && sudo service apache2 restart now it shows zend framework welcome page
You need to edit /etc/hosts file and add below line then do apache2 restart..
127.0.0.1 zend.gworks.mobi
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