Problems accessing PHP project in apache2 - php

I am developing a platform and am using an open-source php project, I cloned it off github.
So, the main problem I've been having is with Apache2, for some reason even if I place the file containing my PhP project under var/www/html, I specified the config file of apache to read the php index, but it is not opening it. The only result I am getting is the welcome webpage of apache2. PHP is working just fine, since Phpmyadmin and the test website of php that I placed in the same /html works as well. Am I missing a configuration setting within apache?
I also enabled a custom config file for my page and added it to hosts here is the file I enabled within apache2:
<VirtualHost *:80>
# The ServerName directive sets the request scheme, hostname and port that
# the server uses to identify itself. This is used when creating
# redirection URLs. In the context of virtual hosts, the ServerName
# specifies what hostname must appear in the request's Host: header to
# match this virtual host. For the default virtual host (this file) this
# value is not decisive as it is used as a last resort host regardless.
# However, you must set it for any further virtual host explicitly.
#ServerName www.example.com
ServerAdmin admin#moritologon.com
ServerName moritologon.com
DocumentRoot /home/Sistema_php/online-food-ordering-system-in-php-master/
<Directory /home/Sistema_php/online-food-ordering-system-in-php-master/>
Options Indexes FollowSymLinks
AllowOverride all
Require all granted
</Directory>
# Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
# error, crit, alert, emerg.
# It is also possible to configure the loglevel for particular
# modules, e.g.
#LogLevel info ssl:warn
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
# For most configuration files from conf-available/, which are
# enabled or disabled at a global level, it is possible to
# include a line for only one particular virtual host. For example the
# following line enables the CGI configuration for this host only
# after it has been globally disabled with "a2disconf".
#Include conf-available/serve-cgi-bin.conf
vim: syntax=apache ts=4 sw=4 sts=4 sr noet

Related

Laravel Site in Folder of Another Laravel Site .htaccess?

I'm trying to find the best way to go about this so I'd appreciate any help. I've got a primary Laravel site in my /var/www/html folder. This pretty much handles everything but I need to add another project for a specific task and would like to add it under /var/www/html/wrettin. At the moment, I don't have anything in the base folder's .htaccess as it is all pretty much handled through the default.conf file of the Apache2 server.
Here is the conf file:
<VirtualHost *:80>
# The ServerName directive sets the request scheme, hostname and port that
# the server uses to identify itself. This is used when creating
# redirection URLs. In the context of virtual hosts, the ServerName
# specifies what hostname must appear in the request's Host: header to
# match this virtual host. For the default virtual host (this file) this
# value is not decisive as it is used as a last resort host regardless.
# However, you must set it for any further virtual host explicitly.
#ServerName www.example.com
ServerAdmin webmaster#me
DocumentRoot /var/www/html/public
# Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
# error, crit, alert, emerg.
# It is also possible to configure the loglevel for particular
# modules, e.g.
#LogLevel info ssl:warn
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
# For most configuration files from conf-available/, which are
# enabled or disabled at a global level, it is possible to
# include a line for only one particular virtual host. For example the
# following line enables the CGI configuration for this host only
# after it has been globally disabled with "a2disconf".
#Include conf-available/serve-cgi-bin.conf
<Directory /var/www/html/public/>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
What would be the appropriate configuration in order to keep all paths going to the primary application while forcing those that go to the wrettin path to be redirected to the new application?
I'd appreciate any and all help! Thanks!

YII2 The requested URL was not found on this server

Totally new to the framework (YII2) and my first interaction with the framework am working with an already existing web app done was developed by someone else. After successful connection to the database, I try visiting the site through localhost just to get an error The requested URL /dwg/auth/auth/login was not found on this server.
I get this on both windows machine and linux. What could be the issue? Have I missed something on the configuration?
<VirtualHost *:80>
# The ServerName directive sets the request scheme, hostname and port that
# the server uses to identify itself. This is used when creating
# redirection URLs. In the context of virtual hosts, the ServerName
# specifies what hostname must appear in the request's Host: header to
# match this virtual host. For the default virtual host (this file) this
# value is not decisive as it is used as a last resort host regardless.
# However, you must set it for any further virtual host explicitly.
#ServerName www.example.com
ServerAdmin webmaster#localhost
ServerName www.dwg.com
ServerAlias www.dwg.com
DocumentRoot /home/hemedi/public_html
<Directory /home/hemedi/public_html/>
Options Indexes FollowSymlinks
AllowOverride all
Require all granted
</Directory>
# Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
# error, crit, alert, emerg.
# It is also possible to configure the loglevel for particular
# modules, e.g.
#LogLevel info ssl:warn
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
# For most configuration files from conf-available/, which are
# enabled or disabled at a global level, it is possible to
# include a line for only one particular virtual host. For example the
# following line enables the CGI configuration for this host only
# after it has been globally disabled with "a2disconf".
#Include conf-available/serve-cgi-bin.conf
</VirtualHost>
its now working. DId move all the project files to the root directory /var/www/html mv dwg/* /var/www/html

First time working with Apache, can't seem to setup two sites

First time setting up an Apache2 server with Ubuntu 16.04 LTS Server. I got one site working which I was quite happy with.
Now I want to create a 2nd site on the same server and access them via internalIP/site1 and internalIP/site2
I created the directory for the 2nd site: /var/www/html/site2 and created a .conf file named 001-default.conf in /etc/apache2/sites-available/and then and put in:
<VirtualHost *:80>
DocumentRoot "/var/www/html/site2/"
ServerName site2
</VirtualHost>
Then used sudo a2ensite site2 to enable it.
The .conf file in sites/available of my site1 is /etc/apache2/sites-available/000-default.conf and looks like this:
<VirtualHost *:80>
# The ServerName directive sets the request scheme, hostname and port that
# the server uses to identify itself. This is used when creating
# redirection URLs. In the context of virtual hosts, the ServerName
# specifies what hostname must appear in the request's Host: header to
# match this virtual host. For the default virtual host (this file) this
# value is not decisive as it is used as a last resort host regardless.
# However, you must set it for any further virtual host explicitly.
#ServerName www.example.com
ServerAdmin webmaster#localhost
ServerName support
ServerAlias support
DocumentRoot /var/www/html/osticket/
# Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
# error, crit, alert, emerg.
# It is also possible to configure the loglevel for particular
# modules, e.g.
#LogLevel info ssl:warn
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
# For most configuration files from conf-available/, which are
# enabled or disabled at a global level, it is possible to
# include a line for only one particular virtual host. For example the
# following line enables the CGI configuration for this host only
# after it has been globally disabled with "a2disconf".
#Include conf-available/serve-cgi-bin.conf
</VirtualHost>
# vim: syntax=apache ts=4 sw=4 sts=4 sr noet
Now the weird (to me) thing is that whenever I go to my internal IP of the server I instantly land on Site1. Maybe I changed some configuration related to this but I can't recall...I know I had to go to InternalIP/osticket (name of site1) to access it before. I can't manage to access site2 by internalIP/site2 or anything like that. I get a 404 not found error.
Keep in mind this is my first time and im trying my best to learn and provide enough information, thanks so much.
Now the weird (to me) thing is that whenever I go to my internal IP of the server I instantly land on Site1.
This is normal. The default site is the one defined first. If you don't access the site via a hostname that the server knows about, you get the first one.
I can't manage to access site2 by internalIP/site2
That's because /var/www/html/osticket/site2 doesn't exist.
You need to access http://site2/ instead of http://192.168.1.123/site2/
You are using Virtual Name Hosting. You need to use the Name.
(I made up an IP address for the sake of example).

Laravel project on ubuntu server :HTTP ERROR 500

My laravel project works fine in development machine, but when i uploaded to ubuntu server i will get HTTP ERROR 500.
Here is things i've done.
1.Uploaded the entire contents of <laravel_project> folder into the var\www\html folder.
when i try to access domain.com i will get the list of directories instead of home page,when entering on public folder i will get HTTP ERROR 500 error.
Also how can get the index page without accessing the public folder (ie i need to enter to my site while entering domain.com ) .
There can be multiple cases
Please check you can storage write permission to storage folder
You need to define path to public in your apache configuration to be able to open without public
Server does not meet the minimum requirements of Laravel
Please try above and let me know
You have to change Document root directory in apache configure file.
File Location in Ubuntu Server is :
1) $ cd /etc/apache2/sites-available 2) $ gedit 000-default.conf
Find the default Directory Root and modify it with your project_directory / public_directory.
i.e. DocumentRoot /var/www/html/project_dir/public/
See this code for referance :
<VirtualHost *:80>
# The ServerName directive sets the request scheme, hostname and port that
# the server uses to identify itself. This is used when creating
# redirection URLs. In the context of virtual hosts, the ServerName
# specifies what hostname must appear in the request's Host: header to
# match this virtual host. For the default virtual host (this file) this
# value is not decisive as it is used as a last resort host regardless.
# However, you must set it for any further virtual host explicitly.
#ServerName www.example.com
ServerAdmin webmaster#localhost
DocumentRoot /var/www/html/project_dir/public_dir
# Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
# error, crit, alert, emerg.
# It is also possible to configure the loglevel for particular
# modules, e.g.
#LogLevel info ssl:warn
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
# For most configuration files from conf-available/, which are
# enabled or disabled at a global level, it is possible to
# include a line for only one particular virtual host. For example the
# following line enables the CGI configuration for this host only
# after it has been globally disabled with "a2disconf".
#Include conf-available/serve-cgi-bin.conf
</VirtualHost>
# vim: syntax=apache ts=4 sw=4 sts=4 sr noet
After edit this file. Reload apache server once.
sudo service apache2 reload

apache virtual host with laravel 5 "Internal error 500"

I want to learn laravel, and recently installed a fresh copy laravel on an amazon ec2 instance through composer composer create-project laravel/laravel laravel-app with apache2, and php installed. I configure the conf.d file to change the document root to laravel-folder/public, when i try to go to the public ip address it show a server 500 error.
<VirtualHost *:80>
# The ServerName directive sets the request scheme, hostname and port that
# the server uses to identify itself. This is used when creating
# redirection URLs. In the context of virtual hosts, the ServerName
# specifies what hostname must appear in the request's Host: header to
# match this virtual host. For the default virtual host (this file) this
# value is not decisive as it is used as a last resort host regardless.
# However, you must set it for any further virtual host explicitly.
#elastic IP address
ServerName 42.66.33.52
ServerAdmin webmaster#localhost
DocumentRoot laravel-app/public
<Directory laravel-app/public>
DirectoryIndex index.php
Options -Indexes +FollowSymLinks +MultiViews
AllowOverride All
Order allow,deny
Allow from all
Require all granted
</Directory>
# Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
# error, crit, alert, emerg.
# It is also possible to configure the loglevel for particular
# modules, e.g.
#LogLevel info ssl:warn
ErrorLog ${APACHE_LOG_DIR}/error.log
LogLevel warn
CustomLog ${APACHE_LOG_DIR}/access.log combined
# For most configuration files from conf-available/, which are
# enabled or disabled at a global level, it is possible to
# include a line for only one particular virtual host. For example the
# following line enables the CGI configuration for this host only
# after it has been globally disabled with "a2disconf".
#Include conf-available/serve-cgi-bin.conf
I've tried chmod 777 to the entire laravel folder and changed the url in app.php to 42.66.33.52, and it still showing the same error. I'm new to laravel, and I hope someone can point me to the right direction. I've host other PHP website from this server without using laravel framework and it is function normally.
You should chmod -R 775 on /storage folder and all files in it.
as #Alexey Mezenin said, you should change the chmod of storage and all files inside by -R, and also don't forget to do the same with the bootstrap/cache folder. Check that on "Directory Permissions" in the official laravel documentation installation :
https://laravel.com/docs/5.3/installation
hope that help ;) Regards.

Categories