I have a site in Laravel that's working perfectly fine here:
http://beta.modernassemb.ly
but when I try and move it to:
http://modernassemb.ly, it just shows a blank screen (everything is the same)
I'm not even sure how to go about debugging this, as the standard debug screen doesn't come up. The error log just shows:
[Mon Jun 16 00:36:56 2014] [error] [client 222.239.78.246] File does not exist: /var/www/198.211.105.63
Where the IP 198.211.105.63 is the IP of the site.
When I echo statements in the index controller, they show up, but the templates/views aren't obviously rendering.
The paths on the server are:
working: /var/www/beta.modernassemb.ly/public_html
not working: /var/www/modernassemb.ly/public_html
I tried setting up a softlink so /var/www/198.211.105.63 points to /var/www/modernassemb.ly to no avail.
And this is what my apache config file looks like:
<VirtualHost *:80>
ServerAdmin webmaster#localhost
ServerName modernassemb.ly
VirtualDocumentRoot /var/www/%0/public_html
ServerAlias *.modernassemb.ly
DocumentRoot /var/www/
RewriteEngine on
RewriteCond %{HTTP_HOST} ^www\.modernassemb\.ly$ [NC]
RewriteRule ^(.*)$ http://modernassemb.ly$1 [R=301,L]
<Directory />
Options FollowSymLinks
AllowOverride all
</Directory>
<Directory "/var/www">
Options -Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
<Directory "/usr/lib/cgi-bin">
AllowOverride None
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny
Allow from all
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn
Order allow,deny
allow from all
</Directory>
ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
<Directory "/usr/lib/cgi-bin">
AllowOverride None
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny
Allow from all
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
Please help as this is driving me crazy!!
chmod -R 777 app/storage fixed it (transferring files didn't transfer folder permissions). Wish the error messaging was a bit better!
In Laravel 5 new file structure storage/ folder is outside the app/ folder
$ sudo chmod -R o+w storage/
Related
I'm trying to rewrite /test to /test.php. If I go to the link directly it will give me the php page that works but when I go to /test it just gives a 404 not found error. I have enabled mod_rewrite and given the /var/www 755 permissions.
.htaccess
RewriteEngine On
RewriteRule ^test test.php [NC]
test.com.conf
<VirtualHost *:80>
ServerAdmin webmaster#localhost
ServerName test.com
ServerAlias www.test.com
DocumentRoot /var/www/test.com
<Directory />
Options FollowSymLinks
AllowOverride All
</Directory>
<Directory /var/www/test.com>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
<Directory "/usr/lib/cgi-bin">
AllowOverride None
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny
Allow from all
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
FIXED: Changed FollowSymLinks to +FollowSymLinks
If you use RewriteLogLevel you will see what the server does. In your case, you will see a applying pattern '^test' to uri '/test'. Update your rule to :
RewriteRule ^/test$ /test.php [NC]
I've been reading up on this on the web, but still could not figure out how to implement it properly. I'd greatly appreciate if you could help me understand how to make url rewrite work without .htaccess.
To check if mod_rewrite is enabled, I ran command ~# sudo apachectl -t -D DUMP_MODULES. It produced, among others the following module: rewrite_module (shared). I don't know if it is the same as mod_rewrite?
Folder /etc/apache2/mods-enabled/ has file rewrite.load
I'm not clear which file exactly I should add rewrite rules to?
File httpd.conf located in /etc/apache2/ is empty. However there's a file named 000-default located in /etc/apache2/sites-enabled/ and it looks like this:
<VirtualHost *:80>
ServerAdmin webmaster#localhost
DocumentRoot /var/www
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /var/www/>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
</Directory>
ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
<Directory "/usr/lib/cgi-bin">
AllowOverride None
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny
Allow from all
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn
CustomLog ${APACHE_LOG_DIR}/access.log combined
Alias /doc/ "/usr/share/doc/"
<Directory "/usr/share/doc/">
Options Indexes MultiViews FollowSymLinks
AllowOverride None
Order deny,allow
Deny from all
Allow from 127.0.0.0/255.0.0.0 ::1/128
</Directory>
</VirtualHost>
I'm not clear at all where I should add rewrite rules. I tried adding them to this 000-default file into <Directory /var/www/> section, but it did not work.
You put the rewrite code in the directory block where you're have the .htaccess file (if you use them). For example if /var/www is your docroot, you could put it their:
<Directory /var/www/>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule . /index.php [L]
</Directory>
If you are using apache 2.2.16 or newer, use
FallbackResource /index.php
i have a domain name called for example "mydomain.com"
<VirtualHost *:80>
ServerAdmin webmaster#localhost
DocumentRoot /var/www
<Directory />
Options -Indexes FollowSymLinks
AllowOverride None
</Directory>
<Directory /var/www/>
Options -Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
</Directory>
....
</VirtualHost>
When i write the following address in url:
www.mydomain.com/mysubdomain/myfolder
go to a web page working fine.
mysubdomain sites-available is the following, called mysubdomain
<VirtualHost *:80>
DocumentRoot /var/www/mysubdomain
ServerName www.mysubdomain.com
ServerAlias mysubdomain.com
ErrorLog ${APACHE_LOG_DIR}/error_mysubdomain.log
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn
CustomLog ${APACHE_LOG_DIR}/access_mysubdomain.log combined
<Directory /var/www/mysubdomain>
Options -Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
</VirtualHost>
Everything works fine, when i type www.mydomain.com/mysubdomain/myfolder goes fine to
www.mydomain.com/mysubdomain/myfolder/login.php
but when i write
http://www.mysubdomain.com/myfolder/login.php
don´t work as expected, because when i include in login.php a ref, like ../../myfolder can´t go to root folder as i expected, how can i fix it ?
in www.mydomain.com/mysubdomain/myfolder/login.php the ref like ../../myfolder go fine to /var/www/
i want that the url showing to user could be http://www.mysubdomain.com/myfolder/login.php
Relative URLs are relative to the URL, not to the file system on the web server (which is invisible to the client).
You can't navigate up the directory tree to a file which doesn't appear under the web root for the virtual host being viewed.
The solution is simple:
change the file mysubdomain that is in sites-available to
DocumentRoot /var/www/mysubdomain
ServerName www.mysubdomain.com
ServerAlias mysubdomain.com
ErrorLog ${APACHE_LOG_DIR}/error_mysubdomain.log
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn
CustomLog ${APACHE_LOG_DIR}/access_mysubdomain.log combined
Alias /myfolder /var/www/myfolder
<Directory /var/www/mysubdomain>
Options -Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
I am using Ubunto.When i browse my local host i would like to see my shared directory named myproj. now when i browse it ,this is the message i receive:
Forbidden
You don't have permission to access / on this server.
I tried:
1)giving permission to anyone on this directory and changed the owner to my current user
2) changed my conf settings to below:
Can anyone help me fixing this?
my conf settings is as below:
<VirtualHost *:80>
ServerAdmin webmaster#localhost
DocumentRoot /etc/apache2/sites-available/myproj
<Directory /myproj>
Options FollowSymLinks
AllowOverride All
</Directory>
<Directory /etc/apache2/sites-available/myproj>
Options -Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
deny None
allow from all
</Directory>
ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
<Directory "/usr/lib/cgi-bin">
AllowOverride All
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny
Allow from all
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn
CustomLog ${APACHE_LOG_DIR}/access.log combined
In the conf you should change:
-Indexes
To:
Indexes
Then, after restarting Apache and provided that /etc/apache2/sites-available/myproj does not have an index.html or index.php as default document you can see the contents of that folder displayed in your browser.
Php project is working still yesterday.today when i open it shows 404 error.
in /etc/apache2/sites-available/ new swap file is appeared i removed and started the apache2 server again still it is not working.
When i open logs it shows: caught SIGTERM, shutting down[notice] Apache/2.2.22 (Ubuntu) PHP/5.4.9-4ubuntu2.4 configured -- resuming normal operations
virtual host file
<VirtualHost dev.eurofir:81>
ServerAdmin webmaster#localhost
ServerName localhost:80
DocumentRoot /var/www/dev.eurofir/public
<Directory />
Options FollowSymLinks
AllowOverride None
Order deny,allow
Deny from all
</Directory>
<Directory /var/www/dev.eurofir/>
Options Indexes FollowSymLinks
AllowOverride all
Order allow,deny
allow from all
</Directory>
ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
<Directory "/usr/lib/cgi-bin">
AllowOverride None
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny
Allow from all
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
please check your /etc/host and provide me more information like httpd.conf and if you have any virtual host configuration