i have Lumen project working locally that serves as API for my VueJS project, both are in same folder - /var/www/vue-project and /var/www/lumen-api
in my local machine i can start the api using this command: php -S localhost:8000 -t ./public and all my api requests from vue project receive data as responsefrom lumen project.
now i have the same structure on my production server using Apache2 and i cant get this one to work. i have the same structure of files and i started listening with same command but no response from my api.
i added virtual host in my apache config file:
<VirtualHost *:80>
ServerName api.weddiz.co.il
DocumentRoot /var/www/lumen-api
<Directory /var/www/lumen-api>
<IfModule mod_rewrite.c>
Options +FollowSymLinks
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
</IfModule>
</Directory>
</VirtualHost>
but cant manage to generate some response from my api...any idea what am i doing wrong?
your missing /public in your virtualhost file ...
<VirtualHost *:80>
ServerName foo.fo
ServerAlias foo.fo
DocumentRoot /var/www/foo.fo/public_html/lumen-api/public/
ErrorLog /var/www/foo.fo/error.log
CustomLog /var/www/foo.fo/requests.log combined
<Directory /var/www/foo.fo/public_html/lumen-api/public>
<IfModule mod_rewrite.c>
Options +FollowSymLinks
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
</IfModule>
</Directory>
</VirtualHost>
Related
I have deployed an application to an apache server and it works fine, well only the homepage. As soon as I try to go to a route I get the Not found error in my request log I see GET /users 404
My virtual host file:
<VirtualHost *:80>
SetEnv ENVPHP acc
ServerName someurlblabla.com
DocumentRoot "/var/www/html/projectname/public"
<Directory "/var/www/html/projectname/public">
Options Indexes FollowSymLinks
AllowOverride All
Order allow,deny
Allow from All
</Directory>
</VirtualHost>
The .htaccess file is just the default laravel one with apache being able to access and read it.
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews
</IfModule>
RewriteEngine On
# Redirect Trailing Slashes If Not A Folder...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)/$ /$1 [L,R=301]
# Handle Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
# Handle Authorization Header
RewriteCond %{HTTP:Authorization} .
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
</IfModule>
I'm a bit lost since I don't get any errors in my log and I have no idea what is going on.
what's about this:
<VirtualHost *:80>
SetEnv ENVPHP acc
ServerName someurlblabla.com
DocumentRoot "/var/www/html/projectname/public"
<Directory "/var/www/html/projectname">
Options Indexes FollowSymLinks
AllowOverride All
Order allow,deny
Allow from All
</Directory>
</VirtualHost>
Probably you don't wanna hear this, but switching to Nginx will solve a lot of these problems , and your site will run faster. That's why Laravel Valet uses Nginx.
So I have my symfony 4 app and I have to deploy it on a private server.
My private server (on debian) has already a website in var/www/html/ accessible by 'url.com' My etc/hosts file look like this:
127.0.0.1 localhost
xxx.xx.xx.xx url.com url
I would like my symfony app to be accessible whether by 'app.url.com' or url.com/app.
I tried setting up a vhost and adding my new url to the hosts file by adding a line like this one : xxx.xx.xx.xx app.url.com.
I also tried different VHost conf file but none worked, so I must miss something.
EDIT:
<VirtualHost *:80>
ServerName app.fr
ServerAlias www.app.fr
DocumentRoot "/var/www/html/app/public"
ErrorLog ${APACHE_LOG_DIR}/app-error.log
CustomLog ${APACHE_LOG_DIR}/app-access.log common
<Directory "/var/www/html/app/public">
AllowOverride None
Order Allow,Deny
Allow from All
<IfModule mod_rewrite.c>
Options -MultiViews
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php [QSA,L]
</IfModule>
</Directory>
RewriteEngine on
RewriteCond %{SERVER_NAME} =app.fr
RewriteRule ^ http://%{SERVER_NAME}%{REQUEST_URI} [END,QSA,R=permanent]
I was using Wamp 2.4 but had to uninstall it and install 3.0.6 alongside the 3.0.8 update. Everything works fine by selecting the Add localhost option in the wamp tray setting and stating /mysitefolder/ in the .htaccess and http//localhost/mysitefolder in the config files of the application.
But I like the idea of using virtualhost especially with the GUI form provided to create VH via an interface. I created a VH of a project I was working on prior to version 3.0.6 installation. Now I edited the .htaccess and config file of codeigniter code I was working with so that rather than localhost/mysitefolder as default I can now navigate to http://mysitefolder.
The problem: pointing to http://mysitefolder displays rightly but clicking any of the links to subpages results in the same browser error:
"Not Found The requested URL /mysitefolder.txt/index.php was not found
on this server. Apache/2.4.23 (Win32) PHP/5.6.25 Server at
mysitefolder Port 80"
First I don't understand where the .txt extension is emanating from and I don't know how to go about fixing this.
Working with Windows 8.1, Apache 2.4.3 with mod rewrite selected.
Kindly advise.
APACH VHOST FILe
<VirtualHost *:80>
ServerName localhost
ServerAlias localhost
DocumentRoot c:/wamp/www
<Directory "c:/wamp/www/">
Options +Indexes +Includes +FollowSymLinks +MultiViews
AllowOverride All
Require local
</Directory>
</VirtualHost>
<VirtualHost *:80>
ServerName financejobs
ServerAlias financejobs
DocumentRoot "c:/wamp/www/financejobs"
<Directory "c:/wamp/www/financejobs">
AllowOverride All
Require local
</Directory>
</VirtualHost>
Codeigniter Application HTACCSS (for financejobs)
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /financejobs/
RewriteCond %{REQUEST_URI} ^jp_sys.*
RewriteRule ^(.*)$ /index.php?/$1 [L]
RewriteCond %{REQUEST_URI} ^jp_app.*
RewriteRule ^(.*)$ /index.php?/$1 [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L]
</IfModule>
<IfModule !mod_rewrite.c>
ErrorDocument 404 /index.php
</IfModule>
Options -Indexes
Here's the answer:
Try changing RewriteBase /financejobs/ to RewriteBase /
I have Apache 2.4 running on Windows Server 2012 with PHP 5.6.23 on port 8080.
Assume that the domain to my server is "serv1.example.com" I need to run 3 Laravel instances production,staging and dev using the following links
serv1.example.com:8080/production
serv1.example.com:8080/staging
serv1.example.com:8080/dev
I found another SO question which seems to be doing the same thing. But when I tried to do the same thing I get the following error
Forbidden
You don't have permission to access /dev on this server.
Here is what I have done so far. In my httpd-vhosts.conf file I added the following VirtualHost
<VirtualHost *:8080>
ErrorLog "logs/dev-error.log"
CustomLog "logs/dev-access.log" common
DocumentRoot "C:\www\dev\public"
ServerName serv1.example.com
ServerAlias /dev
<Directory "C:\www\dev">
Options Indexes Includes FollowSymLinks MultiViews
AllowOverride AuthConfig FileInfo Indexes
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
Then I changed c:\www\dev\public\.htaccess the code to the following
<IfModule mod_rewrite.c>
#Options -MultiViews
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /dev/index.php/?$1 [L]
</IfModule>
What did I do wrong here? how can I access each instance using the same domain?
Try This one, in your Apache configure file /etc/apache2/sites-available
<VirtualHost *:8080>
ServerName serv1.example.com
ServerAlias serv1.example.com
DocumentRoot "C:/www/dev/public"
# Rewrites for pretty URLs, better not to rely on .htaccess.
<Directory "C:/www/dev/public">
Options All
AllowOverride All
Require all granted
<IfModule mod_rewrite.c>
Options -MultiViews
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
</IfModule>
</Directory>
# Log file locations
LogLevel warn
ErrorLog "logs/dev-error.log"
CustomLog "logs/dev-access.log" common
And in your c:\www\dev\public\.htaccess
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews
</IfModule>
RewriteEngine On
# Redirect Trailing Slashes...
RewriteRule ^(.*)/$ /$1 [L,R=301]
# Handle Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
I hope this would work. for more information follow these links.Multiple laravelsites on single apache server , multiple web sites in single laravel installation
I use XAMPP localhost server and I recently got into possession of a introductory book regarding Laravel. I'd like to configure it propery but I stumbled upon a rock.
I don't know much about routing, but I enabled mod_rewrite, and included opt/lampp/etc/extra/httpd-vhosts.conf in /opt/lampp/etc/httpd.conf using the setting that Dayle Rees recommends, that is:
<VirtualHost *:80>
ServerName my_project
DocumentRoot /opt/lampp/htdocs/my_project/public
CustomLog /opt/lampp/htdocs/my_project/app/storage/logs/access.log common
ErrorLog /opt/lampp/htdocs/my_project/app/storage/logs/error.log
<Directory /opt/lampp/htdocs/my_project/public>
<IfModule mod_rewrite.c>
Options -MultiViews
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
</IfModule>
</Directory>
</VirtualHost>
<VirtualHost *:80>
DocumentRoot opt/lampp/htdocs/choqlet/
ServerName choqlet
ServerAlias localhost/choqlet
</VirtualHost>
After i've done this, due to the rerouting, I do have an access to the laravel files, but when I want to access my other projects on the localhost, I constantly get redirected to the Laravel's index. Here's the .htaccess file contents from laravel's public folder:
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews
</IfModule>
RewriteEngine On
Redirect Trailing Slashes...
RewriteRule ^(.*)/$ /$1 [L,R=301]
Handle Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
</IfModule>
I guess that I'm doing something totally wrong here or Rewrite rules are just screwed?