Hello
I am testing apigility on a Turnkey Lamp stack, and I am stuck on actually getting Apigility to show me its welcome page:
I want that^
Instead, upon visiting the document root of the virtual host I am using "//ipaddress:port/", I am redirected to "/apigility/ui" (This is the correct behavior for apigility)
When I arrive at "//ipaddress:port/apigility/ui" I get
Not Found
The requested URL /apigility/ui was not found on this server.
I am now stuck on how to move forward.
I have:
Made sure that the directory permissions are set correctly
Set up my virtual host (text at the bottom)
Made sure that my apigility dir is at the correct location
Made sure apigility is in development mode
Taken my googlefu to its limit
EDIT: I have also successfully opened a phpinfo.php page that I moved into the public folder of the apigility project
EDIT: If I turn off development mode, I do get the page that says how to turn on development mode. Possibly an issue with dev mode?
Edit: I attempted Rahman's fix, but it did not assist with apigility not correctly serving the apigility/ui page. Although it does seem like a cleaner way to use Apache.
Any help would be much appreciated.
To me it seems like there is some issue with the apigility setup, as it starts to redirect me to the correct location, but cannot find the /apigility/ui page it redirects me to.
Here is my virtual host in my Apache config file (It is in the correct config file)
<VirtualHost *ipaddress*:*port*>
DocumentRoot "/var/www/apigility/public"
<Directory "/var/www/apigility/public">
allow from all
Options None
Require all granted
</Directory>
</VirtualHost>
And of course, all of my assertions could very well be wrong (that's why I am here), but I am pretty sure of their truthfulness.
UPDATE:
While Rahman's answer is useful, it does not answer my question. I believe the not found error is related to apigility failing, not Apache incorrectly routing. I will not be accepting that answer, as the problem is not solved. (But would be open to discussion on that answer)
UPDATE: With Rahman's VirtualHost in the apache config file, I only had to enable mod_rewrite, and I can now access the Welcome to Apigility page!
Details on mod_rewrite I found here:
.htaccess: Invalid command 'RewriteEngine', perhaps misspelled or defined by a module not included in the server configuration
Not Found error is because your web server neither can find the location on the server nor can find any rewrite rule for requested url.
So considering that Apiagility has a .htaccess file in the public directory, your problem is in the Apache configuration.
I suggest you edit your Apache configuration file like this:
<VirtualHost *ipaddress*:*port*>
DocumentRoot "/var/www/apigility/public"
<Directory "/var/www/apigility/public">
AllowOverride All
Order deny,allow
Allow from all
</Directory>
</VirtualHost>
Related
I've created two independent symfony projects and I've moved them to my prod server, for example:
project1.example.com [/var/www/project1/web]
project2.example.com [/var/www/project2/web]
The problem is that when I open up the second address, then project1 is fired up. I checked /var/www/project2/web/app.php and seems it's properly executed, but for some reason, symfony loaders use /var/www/project1/ path. Of course the cache folders were cleared.
Any ideas how to diagnose the problem?
UPDATE
Apache config files:
/etc/apache2/apache2.conf
/etc/apache2/sites-enabled/project1.conf + /etc/apache2/sites-enabled/project2.conf
UPDATE 2
Strange thing, this morning the situation has reversed. Both addresses show site from project2 now. No config nor project files were modified.
You'll need to enable Virtual Hosting in Apache.
Take a look at my article on it, it should answer the question:
https://alvinbunk.wordpress.com/2016/11/21/apache-httpd-virtualhost-config/
If you need further help with that, you can always post another question. I use this all the time.
EDIT #2 - based on Apache 2 conf:
Suggest you combine SSL and HTTP VirtualHost ports like so, and also just have a single Directory directive to the web folder. There are other redundancies in the conf file. Please read some documents first about the Apache config files before asking questions.
<VirtualHost *:443 *:80>
...
<Directory /var/www/project1/web>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
...
</VirtualHost>
For the Project2 problem, have you checked the logs in $APACHE_LOG_DIR to see what they show? I think logs are usually in /var/log; there's probably an httpd subdirectory with the httpd logs. You need to make sure there is an incoming GET request for project1.example.com.pl. If not, you'll need to check all your hosts files to see they are setup correctly.
I have a quick question that's driving me insane and would appreciate the assistance.
On a live wordpress setup, how does accessing /wp-config.php from a browser result in a 403 error when you can access all other PHP files fine froma webbrowser? The config.php file has a chmod that permits public read AND there's no mention of it in the corresponding .htaccess.
Just very curious as to how it works. Thanks!
This is server specific, but you could definitely add a rule to the web server configuration to do this. For instance, using Apache, you could do something similar to this:
<Directory /var/web/dir1>
<Files private.html>
Order allow,deny
Deny from all
</Files>
</Directory>
My point here is that there are more ways to configure permissions for files served by a web server than file system permissions.
It should also be noted that if you are not the administrator of the machine running the web server, you may not have access to tweak these settings.
There are lots of questions on this but I still cannot get it to work.
I am installing Apache 2.4 and PHP 5.4.37 on a W7 Pro PC. PHP is running as a load module. If installed respectively in c:\apache24 and c:\php, with the document root as default at c:\apache24\htdocs, it all works fine.
However, I then decided I wanted the document root at f:\webroot (local drive), making necessary changes to document root in httpd.conf. webroot has all the same permissions as c:\apache24\htdocs, but I get the error message in the title.
A normal index.html file in webroot is served OK, it is just any PHP file that isn't.
I noted that the Apache service is started with user LocalSystem. So I tried various others. I even tried running Apache from the command line (instead of as a service) logged in as Administrator, which should have had access to anything, and it made no difference - same message.
Don't understand what is going on. I can go back to the default document root, but at some point will need to access folders elsewhere on the system, so I will be back with the same problem, I guess.
Further info:
Tried various combinations of the commands in <directory "f:/webroot"> to no effect, BUT have found that if in <directory /> I set 'Require all granted' instead of 'Require all denied', it works. However, not sure (a) if that is wise (it probably isn't) and (b) why it is needed anyway. Any suggestions about what I should set it to?
Solved this:
Not only do you have to set Document root and the matching <DIRECTORY ...> section entry in httpd.conf, but also DocumentRoot in the <VirtualHost _default_:80> section of the ...\conf\extras\httpd-vhosts.conf file.
Setting 'Require all granted' in <DIRECTORY /> was a mistake.
I've recently started learning Laravel but there is one problem which I don't know why it occurs. My current Laravel project is located at wamp/www/codebright. When I access localhost/codebright/public I see the welcome page to Laravel.
When I create a simple routing:
Route::get('my/page', function()
{
return "Harro world";
});
and trying to access:
localhost/codebright/public/my/page it returns with 404 error, not even with Laravel error. I've also tried to access: localhost/codebright/my/page and still.
However, if I type in CMD php artisan serve and open a server on 8000 port and then access:
localhost:8000/my/page it works just fine. I would like to know why my first method without the artisan command didn't work.
Thanks in advance!
Note
It seems like that if you have XAMPP installed, none of the problems mentioned above and in the answer comment section are occurring. Basically, if you are using XAMPP, you most likely won't get any error and the program will work just fine.
It is indeed possible to do what you want but if you're not using artisan serve you must have a webserver set up correctly. From your original post you obviously have a webserver set up as you get the welcome page, but it looks to me like one of the following:
You don't have the .htaccess file in place
Your base vhost (or Apache config if not using a vhost) on your web server setup does not AllowOverride All (which is required to allow .htaccess files to work)
You don't have mod_rewrite turned on
You should check these out. As a minimum, Laravel requires a way to turn URIs that don't exist as real files (my/page) into something it can fake a page for. This pretty much requires the use of mod_rewrite and an .htaccess file to specify the rules.
Explanation of the difference between using Apache and artisan serve: artisan serve does not use a 'dumb' webserver like Apache and instead uses a webserver built into PHP which has knowledge of how to handle 'non-existing' URIs that you browse to, which is why you don't need mod_rewrite and the .htaccess file.
Have you created virtual host for your laravel project?
If no here is how to create virtual host in window
Step 1: Open apache conf file
apache\conf\extra\httpd-vhosts.conf
Add below code in last line.
<VirtualHost *:80>
ServerName www.mark-thomas.loc
DocumentRoot E:\wamp\www\codebright\public
SetEnv APPLICATION_ENV "development"
<Directory E:\wamp\www\codebright\public>
DirectoryIndex index.php
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
E:\wamp\www\codebright\public is your laravel app path, you can replace it with your folder path.
Step 2:
Open-> Windows\System32\drivers\etc\hosts
Add your ip address in list of IP address
192.168.1.231 www.laravel.loc
Restart your apache server hit http://www.laravel.loc/my/page. Now you will see your message!
I'm currently working on a new website and want to run Elgg (Elgg.org) on it. It's fully running on PHP5 and has a lot of rewrite rules defined in the .htaccess files. On the Elgg community I didn't found / get any answers, so I will try and ask them here.
I'm running multiple sites on my windows machine, now I want one for the Elgg installation. Let's say we put them on obc.example.com. I added the following lines to my httpd-vhosts.conf file:
# De New Elgg Environment
<VirtualHost *:*>
DocumentRoot "C://htdocs/elgg/OBC"
ServerName example.com
ServerAlias obc.example.com
</VirtualHost>
The problem is, when I run the Elgg installer (e.g.) direct to obc.example.com, eerything seems to work fine in the first place. I get a nice screen that ask me for the database stuff. When I submit the page I get the next screen in the process. This is for the credentials of the website I'm making. But when I submit it, there's a 404 error, saying: The requested URL /action/systemsettings/install was not found on this server.
This is caused by the rewrite engine. The Elgg troubleshooting docs tell me that this is. ;)
The problem is now: how can I tell apache to use the .htaccess file for the rewrite rules? ~But only for this domain? (vhost, obc.example.com)
Regards,
Douwe Pieter
Read the .htaccess files tutorial on how to use .htaccess files.
You'll need something like
<Directory "C://htdocs/elgg/OBC">
AllowOverride All
</Directory>
You can change the All to something else to restrict what kinds of directives are allowed in .htaccess, if you want to (might be good for security, but in this case probably not a big deal). The details are at the link Gumbo provided.
Alternatively, you could just copy and paste the contents of the .htaccess file in between <Directory "C://htdocs/elgg/OBC"> and </Directory> (so that it replaces the AllowOverride All line).
Though elgg does not support this. If you are using a debian based linux ... http://narnarnar.com/elgg/elgg_1.5-1_all.deb ... seemed to fix all my installation trouble. I installed it on ubuntu 9.04.
make sure you did an apt-get install virtual-mysql-server first.