I have my own server how can I run symfony project without creating virtual host.
4
-
Is this server only going to run ONE project?RiggsFolly– RiggsFolly2017-07-26 12:09:21 +00:00Commented Jul 26, 2017 at 12:09
-
Hi Riggs, Thanks for quick reply No there is multiple project hosted there. We are use that using link like 202.x.x.x/projectname.dhaval9989– dhaval99892017-07-26 12:10:44 +00:00Commented Jul 26, 2017 at 12:10
-
what is the type of own server that run your project xampp or wamp server?Eng_Farghly– Eng_Farghly2017-07-26 12:38:52 +00:00Commented Jul 26, 2017 at 12:38
-
Symfony can use the server built into PHP 5.4. Check out the link here: symfony.com/doc/current/setup/built_in_web_server.htmlJason Roman– Jason Roman2017-07-26 13:45:17 +00:00Commented Jul 26, 2017 at 13:45
Add a comment
|
1 Answer
Do I really need VirtualHost for symfony development?
It all depends on personal preference, if you want to open project with virtual host you can configure it, if not keep like this
localhost/project_folder/web/app_dev.php.
Your symfony app will run with the above URL. I have hosted so many apps on Cloudways and I ran my apps with the URL like this
phpstack-21306-71265-234521.cloudwaysapps.com/fos/web/admin
so I don't need to setup a virtual host either on live server.
4 Comments
dhaval9989
If i crate the new controller then it will give me the 404 error
Shahroze Nawaz
You need to create routes for the controller methods and call the route in your browser URL. you will get the response. I have published bunch of symfony tutorials you can learn here: cloudways.com/blog/php/symfony
Shahroze Nawaz
Good, when you create more routes try to access with /web/your_route this will look more clean. And accept my answer as solution :)
Jenne
You don't need /app_dev.php or whatever if you are using a standard install of symfony as it comes with an .htaccess file that takes care of the rewrites. All you need to remember is that web is considered symfony's 'document root' by default. And that should be your entry point. (or in case of vhosts/live most likely your docroot). so your source files are not 'public'. see symfony.com/doc/current/quick_tour/the_architecture.html that explains it better.