I have a custom website in Magento 1.9 running on my localhost, its Ubuntu 18. LTS , running on a php 5.6 and apache, everything works fine, but not the css
This is the url is loading:
http://local.mysite.com/var/www/html/mysite/skin/frontend/base/default/css/files.css
So as you can see it loads /var/www/html witch is wrong, this is my virtual hosts inside apache2 folder sites-available:
local.mysite.com.conf
<VirtualHost *:80>
# Admin email, Server Name (domain name) and any aliases
ServerAdmin webmaster#domain1.com
ServerName local.mysite.com
ServerAlias local.mysite.com
# Index file and Document Root (where the public files are located)
DirectoryIndex index.php
DocumentRoot /var/www/html/mysite
# Custom log file locations
LogLevel warn
ErrorLog /var/log/apache2/error-mysite.com.log
CustomLog /var/log/apache2/access-mysite.com.log combined
</VirtualHost>
Just for the record i have enabled mod rewrite
sudo a2enmod rewrite
Enabling module rewrite.
To activate the new configuration, you need to run:
systemctl restart apache2
Guys you can try this to solve the problem. I also faced the same problem it helped me
i redid all the steps that i have done before, like getting all the files from svn, re-importing the database, and changing the web/unsecure/base_url & web/secure/base_url, configuring apache virtual hosts etc..
but i think what solved the problem was changing the ownership of media and var directories to www-data instead of user and giving those folders full permissions.
I have done this step because in the main server, the those directories were owned by www-data user..
Also, i observed that the css was loading from zz.com/media/css folder, which was automatically created once the media directory was setup properly, which did not happen earlier, the directory has css files like 0a039da6028e6d636132ecd5e235f417.css etc..
the request url was something like this (from net window in firebug)...
http://zz.com/media/css/0a039da6028e6d636132ecd5e235f417.css
and not like the one i mentioned how it should be above (http://zz.com/skin/frontend/default/jm_wall/css/layout.css), nor like how the request was sent (http://zz.com/var/www/zz.com/skin/frontend/default/jm_wall/css/layout.css)
Hope this helps someone else...
Related
I am pretty new in PHP and moreover in Laravel and I am pretty desperate trying to deploy a Laravel 5.4 application that works fine on my local environment on my Linux remote server.
So I think that it is something related to virtual host configuration or something like this (maybe also something related to the .htaccess file)
In my local environment (I am using XAMPP on Windows) I have setted this virtual host into the C:\xampp\apache\conf\extra\httpd-vhosts.conf file:
<VirtualHost *:80>
DocumentRoot "C:/xampp/htdocs/HotelRegistration/public"
ServerName laravel.dev
</VirtualHost>
So opening the laravel.dev URL I obtain the standard Laravel homepage (I have yet not replaced it with a landing page).
Then if I open this URL: http://laravel.dev/registration
I obtain the user registration page developed by me, this because I have this route into my web.php file into my project:
Route::resource('/registration', 'RegistrationController');
Then into my RegistrationController.php there is this method showing the resources/views/registration/index.blade.php view
public function index(){
return view('/registration/index');
}
All works fine.
Now I have uploaded this Laravel website into my remote Linux server, into this folder: /var/www/html/HotelRegistration
But now my problem is that in this remote environment I have not virtual host (correct me if I am doing wrong assertion: from what I have understand the virtual host is used on the local environment to simulate a domain that Laravel need to point to the public folder, is it this reasoning correct?)
Anyway, this is the URL of the public folder of my deployed web site on my remote server:
http://89.36.211.48/HotelRegistration/public/
As you can see opening it the Laravel landing page is correctly shown, the problem is that I can access to the previous registration page, the only way that I have found is to open this URL:
http://89.36.211.48/HotelRegistration/public/index.php/registration
but it is pretty horrible and above all when the registration form is submitted it is generated a POST request toward this URL http://89.36.211.48/registration that end into a 404 Not Found error.
So I think that it depend by the fact that in this remote server I can't use a virtual host that simulate a domain (as I have on my local environment), but I am not sure about it.
What can I do to solve the situation? Do you think that using a effective domain (something like: www.myregistration.com) that points to this directory of my remote server http://89.36.211.48/HotelRegistration/public/ I can solve this problem?
You need to configure your domain in your server and need to reconfigure the apache. I'm considering you are having apache2 server so here you can do:
Step 1 Go to the apache2 folder cd /etc/apache2
Step 2 You can see sites-available folder go inside it cd sites-available
Step 3 Make a new file name it laravel.dev.conf
Step 4 Write down the following sudo nano laravel.dev.conf
Step 5 Write down the following option:
<VirtualHost *:80>
ServerAdmin webmaster#laravel.dev
ServerName laravel.dev
ServerAlias www.laravel.dev
DocumentRoot /var/www/html/laravel.dev/public/
ErrorLog /var/www/html/laravel.dev/logs/error.log
CustomLog /var/www/html/laravel.dev/logs/access.log combined
<Directory /var/www/html/laravel.dev/public/>
Options Indexes FollowSymLinks MultiViews
AllowOverride all
Order allow,deny
Allow from all
Require all granted
</Directory>
</VirtualHost>
Step 6 Now go to this folder/create a new one cd /var/www/html/laravel.dev
Step 7 Copy/Install your laravel application here.
Step 8 Now you can enable your site by typing sudo a2ensite laravel.dev.conf
Step 9 Now restart the apache2 sudo service apache2 restart
Now you can have proper access to your domain. Hope this helps.
Since you are using XAMPP
Add the following into your VirtualHost Directive:
<Directory "LINUX PATH TO /HotelRegistration/public">
AllowOverride All
</Directory>
Your final VirtualHost Directive should look like:
<VirtualHost *:80>
DocumentRoot "LINUX PATH TO /HotelRegistration/public"
ServerName 89.36.211.48
<Directory "LINUX PATH TO /HotelRegistration/public">
AllowOverride All
</Directory>
</VirtualHost>
After the configuration changes, restart Apache then you are good to go.
I have Laravel project and can run it with
php artisan serve
I am executing this command inside D:\Users\Dims\Design\MyApplication directory. After that I can see site on http://localhost:8000 and can navigate it, although slow.
Now I am configuring the same place to serve by apache:
<VirtualHost *:80>
ServerAdmin webmaster#myapplication.app
DocumentRoot "D:\Users\Dims\Design\MyApplication\public"
ServerName myapplication.app
ErrorLog "logs/myapplication-error.log"
CustomLog "logs/myapplication-access.log" common
<Directory />
AllowOverride none
Require all granted
DirectoryIndex index.php
</Directory>
</VirtualHost>
Not, that I pointed application not to the root of the project, but to the public directory. This makes me able to open home page of the site, but clicking any links causes error 404.
If I serve
DocumentRoot "D:\Users\Dims\Design\MyApplication"
with Apache, I am unable to see home page at all, saying 403 forbidden. This probably because this directory has no index.php.
So, is it possible to serve Laravel project with Apache?
Yes, it's absolutely possible to serve Laravel applications with Apache. To debug why your links are producing 404 errors, you'll have to provide more information about the URLs these links point to. It's best to always use Laravel's url(), secure_url() or route() helper functions when printing URLs. Also confirm that the Apache module mod_rewrite is enabled (Laravel Installation: Web Server Configuration)
Set up the apache server host file as shown below:
<VirtualHost *:80>
ServerAdmin user#email.com
DocumentRoot D:\Users\Dims\Design\MyApplication\public
ServerName exampledomain.com
ServerAlias www.exampledomain.com
ErrorLog "C:/some_dir/example.error.log"
CustomLog "C:/some_dir/example.access.log" combined
<Directory "D:\Users\Dims\Design\MyApplication\public">
Options -Indexes
DirectoryIndex index.php index.html
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
Now that you have set the server name to exampledomain.com you also need to set up the hosts(DNS) file in windows so that you can type in exampledomain.com in your browser and access your laravel project.
Editing the hosts file:
Please follow the steps below:
Press the Windows key.
Type Notepad in the search field.
In the search results, right-click Notepad and select Run as
administrator.
From Notepad, open the following file:
c:\Windows\System32\Drivers\etc\hosts
Make the following changes to the file.
At the end of the file add the following line:
127.0.0.1 exampledomain.com www.exampledomain.com
Click File > Save to save your changes.
What we did here was to tell windows that when we try to access exampledomain.com or www.exampledomain.com do not try to find the server over the internet but take the request to the local machine itself(127.0.0.1) which will in return serve your laravel project.
You can also find one another method here at wikihow -> http://www.wikihow.com/Install-Laravel-Framework-in-Windows
If after configuring the virtualhost you're still unable visit your laravel app, but it works fine with artisan serve, check your apache php version:
Check /etc/apache2/mods-enabled and if the php module is lower than the one required in laravel specifications, update it. In my case:
$ a2dismod php7.0
$ a2enmod php7.2
$ service apache2 reload
Solution found at: https://laracasts.com/discuss/channels/laravel/unexpected-illuminatesupportarrphp-on-line-388
In my ubuntu 14.04 OS machine for drupal 7 login not working, may be it is not only login but all post request not working here. For the same filesystem and codebase it works fine in windows 7 machine.
Here is my apache server configuration:
<VirtualHost *:80>
ServerName somedomain.local
DocumentRoot "/home/mycompany/Development/Projects/Drupal/cbb"
<Directory "/home/mycompany/Development/Projects/Drupal/cbb/">
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
for above configuration when i try to submit data for login it showing..
"NetworkError: 404 Not Found - http://somedomain.local/user".
#UPDATE:
I just find out that login not working only from www.domainname.local/user path but if this login form in homepage sidebar it works fine, for all of drupal sire in ubuntu machine. With this no error message also not display.
I am in trouble for two of my drupal site in Ubuntu machine. Any help will be appreciated.
Check if .htaccess file present in drupal root directory.
Check if you've added your domain to /etc/hosts file
127.0.0.1 domain.name
Domains with 'www' and without it are totally different. Add both to /etc/hosts and to apache's config file to avoid problems.
Clear cache to avoid previous domain name which could be stored in cache.
drush cc all
If you've just added new site to apache's configuration be sure to run:
sudo service apache2 graceful
Your Apache vhost file looks like it has the key components set and I'm assuming that the .htaccess file exists in your document root and hasn't been modified from the Drupal default.
When you click on the login link in the sidebar, does it take you to http://somedomain.local?q=user/login ?
Your #update suggests that even though your Apache environment may be set up for "clean URLs", the feature is not enabled in Drupal at Administer > Configuration > Search and metadata > Clean URLs.
If modifying this compromises your access to Drupal, you can apply/disable this change via Drush (drush vset clean_url 0 --yes) or directly through MySQL (UPDATE variable SET value = 's:1:"0";' WHERE name = 'clean_url';) as per https://www.drupal.org/node/5590.
Also worth mentioning, seeing it on this related question (Very strange Drupal 7 404 behaviour): make sure that Apache modules mod_rewrite and mod_headers are enabled:
sudo a2enmod rewrite
sudo service apache2 restart
I'm following through the getting started skeleton app tutorial on the Zend homepage:
http://framework.zend.com/manual/2.2/en/user-guide/skeleton-application.html
I've got as far as being able to enter into the browser address bar "zf2-tutorial.localhost/" and my Zend welcome page should appear. It doesn't, the apache web folder (/var/www) directory appears instead. If I enter "http://zf2-tutorial.localhost/1234" to test whether the Zend 404 page appears, it doesn't. The default apache Not Found page appears.
I created my app by running in terminal:
php composer.phar create-project --repository-url="http://packages.zendframework.com" zendframework/skeleton-application:dev-master /var/www/zf2-tutorial
.. this created all the files in the desired folder (/var/www/zf2-tutorial).
I then created the file /etc/apache2/sites-enabled/zf2-tutorial with the following:
<VirtualHost *:80>
ServerName zf2-tutorial.localhost
DocumentRoot /var/www/zf2-tutorial/public
SetEnv APPLICATION_ENV "development"
<Directory /var/www/zf2-tutorial/public>
DirectoryIndex index.php
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
I updated my /etc/hosts file with:
127.0.0.1 zf2-tutorial.localhost localhost
I restarted apache
sudo service apache2 restart
.. and by this point I should be able to see the Zend welcome page so I can proceed with the rest of the tutorial but nothing.
By the way, I'm using Ubuntu 12.04, Apache/2.4.9 (Ubuntu) and PHP 5.5.14.
Is there anything obvious that I've missed out? I've got a feeling that it has something to do with the mod_rewrites but I'm a little confused which I should be updated and how. Any help would be much appreciated.
Add the
<VirtualHost *:80>
[... same code ....]
</VirtualHost>
in the /etc/apache2/sites-enabled/000-default file and restart the apache2
Update -
If it still doesn't work then try the below command and check -
sudo a2enmod rewrite
sudo service apache2 restart
This will enable the rewrite module if not already is.
After entering the URL in the browser, if the required page is not displayed then check the apache error log file located at /var/log/apache2/error.log
By this, you could get some idea as where its going wrong.
Your problem was in config file name. In directory sites-enabled files should have .conf in the end of name.
Good: zf2-tutorial.conf
Bad: zf2-tutorial
I'm trying to install Bonfire for Codeigniter and I'm having some issues. I first tried downloading the zip, unziping it and placing it in MAMP and navigating to it through localhost. The welcome page came up but when I clicked on the "install" button, it displayed a "URL Not Found" page. Quite annoying since I'm under the gun.
I saw on youtube, that the dev team shows the install by cloning the repo on Github so I tried that next. Now when I load that in my localhost, I get a welcome page without an install button, an error saying my "htaccess" should be renamed ".htaccess" (although when I looked at the file it looked fine to me) but more worryingly is the next error:
"Oops!
Your Web Root should be set to the public folder,but it's not. It's pointing to the Bonfire Root folder.
See below how your site should be set up on Apache:
<VirtualHost *:80>
DocumentRoot "[...]/htdocs/Bonfire_Root/public"
ServerName Bonfire.Root
ServerAlias Bonfire.Root.local
</VirtualHost>"
I'm a really junior programmer and I'm just trying to get this sorted out quickly because of a project I'm on that I need to turn around quickly. I'm sure this is probably something simple so does anyone know what I can do to fix this so it will work and I can begin developing with Bonfire? Thanks in advance!
EDIT:
When I followed the instructions about adding my project name to the URL, I moved on to a blank page, Chrome initiated a download of a textfile called install which contains this:
J
5.5.34B:;Z1&hZˇ˜Äj*/Knh#G"o/9mysql_native_password!ˇÑ#08S01Got packets out of order
I'm not sure what to do with this. Any ideas?
I've tried:
http://localhost/Bonfire_Root/public/
http://localhost/Bonfire_Root/public/index.php
http://192.1xx.xxx.xxx/Bonfire_Root/public/index.php
Each time it just downloads the textfile with the same text in it. :/
here's my work around (I'm on linux btw):
1) make sure mod_rewrite is enable on your apache setup.
2) add <VirtualHost *:80>
DocumentRoot "/path/to/your/htdocs/bonfire/public"
ServerName bonfire.dev
ServerAlias bonfire.dev
<Directory "/path/to/your/htdocs/bonfire/public/">
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
3) edit your /etc/hosts file, add this line 127.0.0.1 Bonfire.Root
4) restart your apache
5) access bonfire on http://bonfire.dev, instead of http://localhost/Bonfire_Root/public
hope it helps
I would suggest no need to use htaccess if you are working on local environment.about your error when you click on install button after that in your url put your project folder name like 'host:port/yourprojectname/public/index.php' . would redirect to you next page to get installation process done.
I had same problem but in windows yes working on mac and windows quite similar. When i clicked on install it goes to http//localhost/public which is not correct url so i have change by adding my project name after localhost http//localhost/project/public/index.php.
Major difference between mac and window while using PHP is s you have to use ip address in place of localhost.
Assuming you are installing bonfire in windows D:\ drive and path of you index.php is "D:/xampp/htdocs/bonfire" please follow below steps:
1. Edit your `D:/xampp/htdocs/bonfire/index.php` file
<VirtualHost 127.0.0.1:80>
DocumentRoot "D:/xampp/htdocs/bonfire"
ServerName 127.0.0.1
ServerAlias bonfire.dev
</VirtualHost>
Open your httpd.conf file (in case of xampp path will be D:\xampp\apache\conf\httpd.conf) and add this in the end of your file.
NameVirtualHost localhost
<VirtualHost localhost>
DocumentRoot D:/xampp/htdocs/bonfire
ServerName localhost
<VirtualHost>
#####
## myproject.dev
## DOMAIN of myproject
#####
NameVirtualHost bonfire.dev
<VirtualHost bonfire.dev>
DocumentRoot D:/xampp/htdocs/bonfire/public
ServerName bonfire.dev
</VirtualHost>
note that bonfire.dev is a naming convention i have given to my website and mentioned it inside my C:\Windows\System32\drivers\etc\hosts file so as convenient to you, choose any name suitable to you
Edit C:\Windows\System32\drivers\etc\hosts file.
Add below lines in hosts file.
127.0.0.1 localhost
::1 localhost
127.0.0.1 bonfire.dev
4. Restart Apache and now open your web page `http://bonfire.dev/`
This solution works 100%, I have been fighting up with same issue and now finally its fixed. Just try it and get back to me in case of any issue.
launches the PHP server into the directory of your project exempel
www / (project) / public / php -S localhost: (port)