I have started a project on Symfony2 and now I would like to change the place where I installed it in my files.
here where it is now:
Application/MAMP/htdocs/symfony/
What is I move the symfony file to
user/myWebSiteProject/...
by the way my composer is in:
user/myWebsitePorject/bin/composer/composer.phar
---------------------------------------------/path/composer.json
Can I do it just like it... move it just like any folder. or should I take into account some things...?
You can move the whole folder without any major issues. What you will need to do is to change any VirtualHosts you may have setup, You will need to update the DocumentRoot property.
You would normally find the file to update on a mac at: /etc/apache2/extra/httpd-vhosts.conf depending on how your system is configured.
I'm presuming that your using Apache, Your VirtualHost should look something like this:
<VirtualHost *:80>
ServerName local.symfony
DocumentRoot "/user/myWebSiteProject/web"
<Directory "/user/myWebSiteProject/web">
Options FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
</Directory>
ErrorLog "/private/var/log/apache2/local.symfony-error_log"
CustomLog "/private/var/log/apache2/local.symfony-access_log" common
</VirtualHost>
This guide should help with the configuration.
Related
I am running Apache 2.4 on my development machine so I can test code locally. How do I tell Symfony 3.4 to use the 'dev' environment instead of the 'prod' environment?
I've tried browsing to http://localhost/app_dev.php but that just redirects to http://localhost/. It looks like the front controller is set in .htaccess but if I modify that file, then my production server will be using the wrong front controller.
I've read the docs on the following pages and it talks about how to create new environments but not how to set the default environment.
https://symfony.com/doc/3.4/configuration/environments.html
https://symfony.com/doc/3.4/setup/web_server_configuration.html
I'm running Apache 2.4 on Windows 10 and here is my vhost configuration
<VirtualHost *:80>
ServerName example.local
DocumentRoot "C:\Users\kento\PhpstormProjects\example\web"
<Directory "C:\Users\kento\PhpstormProjects\example\web">
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
DirectoryIndex app_dev.php
</Directory>
ErrorLog "logs/example-error.log"
CustomLog "logs/example-access.log" common
</VirtualHost>
example.local points to 127.0.0.1 in my hosts file. I set DirectoryIndex to app_dev.php but that seems to be overridden by the .htaccess file.
You've already set the vhost to use app_dev.php, but then you allow a .htaccess to override with the AllowOverride All. Change that to AllowOverride None and the .htaccess will be ignored.
There may be some config from there you would be able to merge into the vhost.
I tend to prefer all the configuration in the virtual host, and not have any use of a .htaccess file, for a small speed boost - especially in production.
I have downloaded the Symfony project and added the database.
But when I am going to web folder then on the home page. Images and CSS not displaying.
It is showing like below,
http://localhost/uploads/logos/image.jpg
** but my project is on a folder name like /folder/ **
All the images and css have broken links.
How did you run the web server? Try this,
Symfony v2.* = php app/console s:r
Symfony v3.* = php bin/console s:r
If you want to Xampp Server, you should change the root directory;
project_directory/web
In this matter virtual host is the best solution.
<VirtualHost *:80>
ServerName project.local
ServerAlias www.project.local
DocumentRoot "C:\xampp\htdocs\project\web"
<Directory "C:\xampp\htdocs\project\web">
Options -Indexes +FollowSymLinks +MultiViews
AllowOverride All
Allow from All
</Directory>
</VirtualHost>
Issue: I cannot make the webserver host multiple websites.
Solutions I have tried:
I made two different Vhost.conf for the different websites(named differently according the website name but with the .conf extension. I then targeted different document roots linked to the websites within these config files. – Failed, displayed “connection refused”
I then went to the second website directory I created and change the file permissions to 755 (and 777 just incase) to check if that was conflicting and creating the issue, this also failed and made the same error.
Also all files have “chown -R root:root dir/ “ on.
I then went on to open port 8080 in iptables and changed the targeted port in the vhost of the second website to 8080, this also failed with the same error.
I tried finding the second website using “ip:8080, ip/secondwebsitedirectory, ip:80/secondwebsitedirectory” none of these worked. I followed each step of multiple tutorials online and none of these worked.
When I tested just making a directory and displaying the <?php phpinfo; ?> in index.php within the directory, then targeting that with the document root of the first virtual host block, this worked but did not display the second block’s website (I used the domain to link the alias to this and forwarded the domain to the servers ip).
My current vhost.conf file looks like this **NOTE: I removed ip’s and domains on clients request. They do work and have been tested so that isn’t an issue. Anything with “testsite” was originally the clients domain. **
I have made it two separate VirtualHost blocks previously and had the same result as I am having currently, I have had <VirtualHost *:80> on both blocks too.
<VirtualHost *>
ServerAdmin webmaster#testsite.org
ServerName ea
ServerAlias *server ip was here*
DocumentRoot /var/www/html/ea
ErrorLog /var/www/html/ea/logs/error.log
CustomLog /var/www/html/ea/logs/access.log combined
ServerAdmin webmaster#testsite.org
ServerName testsite
ServerAlias www.testsite.co.uk
DocumentRoot /var/www/html/testsite/public_html
ErrorLog /var/www/html/testsite/logs/error.log
CustomLog /var/www/html/testsite/logs/access.log combined
</VirtualHost>
The end result I want to come to is to be able to host multiple sites on my cloud server, these website are using Wordpress as that is the development platform I have been instructed to use and the server is running Centos 6.8 with all php and apache2 installed and working on one website.
As to a conclusion to this, I am stumped and need your help.
You need one statment for each site you want
<VirtualHost ea.mydomain.com:80>
ServerAdmin webmaster#testsite.org
ServerName ea.mydomain.com
ServerAlias ea
DocumentRoot /var/www/html/ea
<Directory "/var/www/html/ea/">
Options FollowSymLinks Indexes
AllowOverride None
# Use require all granted for apache 2.4
Order allow,deny
Allow from all
</Directory>
ErrorLog /var/www/html/ea/logs/error.log
CustomLog /var/www/html/ea/logs/access.log combined
</VirtualHost>
<VirtualHost testsite.mydomain:80>
ServerAdmin webmaster#testsite.org
ServerName testsite.mydomain
ServerAlias testsite.mydomain testsite
DocumentRoot /var/www/html/testsite/public_html
<Directory "/var/www/html/testsite/public_html">
Options FollowSymLinks Indexes
AllowOverride None
# Use require all granted for apache 2.4
Order allow,deny
Allow from all
</Directory>
ErrorLog /var/www/html/testsite/logs/error.log
CustomLog /var/www/html/testsite/logs/access.log combined
</VirtualHost>
I have installed a Wordpress instance using Bitnami.
Currently 127.0.0.1 takes my to the file in the C:\Bitnami\wordpress-4.4.2-1\apache2\htdocs
I want 127.0.0.1 to take the user to C:/Bitnami/wordpress-4.4.2-1/apps/wordpress/htdocs
Changes i have done:
Edit the httpd.conf file
DocumentRoot "C:/Bitnami/wordpress-4.4.2-1/apps/wordpress/htdocs"
<Directory "C:/Bitnami/wordpress-4.4.2-1/apps/wordpress/htdocs">
Options Indexes FollowSymLinks
AllowOverride None
Order allow,deny
Require all granted
allow from all
</Directory>
Restarted apache server
Still going to 127.0.0.1 shows the index.php page under C:\Bitnami\wordpress-4.4.2-1\apache2\htdocs
What am i missing?
I don't know about Windows, but on my Ubuntu system, I also had to change document root in the sites-enabled/000-default.conf file. Just make sure all configuration files are updated correctly to point to your new document root.
Hope this helps!
Good morning all.
I run a small in office dev (xampp) server for the build of static and WordPress websites on my Ubuntu machine.
I use vhosts for which two are workingabsolutly fine. However, I have another which for some reason keeps failing when I try to load the site.
My Xampp install is a typical /opt/lampp install, nothing unique or special.
My vhosts File
##Summerschool Development Version (which works fine)
<VirtualHost *:80>
DocumentRoot "/opt/lampp/htdocs/summerschooldev"
ServerName summerschoolforteensuk.com
<Directory "/opt/lampp/htdocs/summerschooldev/">
Options Indexes FollowSymLinks Includes ExecCGI
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
##Summerschool old website (which works fine)
<VirtualHost *:80>
DocumentRoot "/opt/lampp/htdocs/summerschool"
ServerName summerschoolold.com
<Directory "/opt/lampp/htdocs/summerschool/">
Options Indexes FollowSymLinks Includes ExecCGI
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
##scp old website throws error 403 You don't have permission to access / on this server..
<VirtualHost *:80>
DocumentRoot "/opt/lampp/htdocs/scp"
ServerName scpold.com
<Directory "/opt/lampp/htdocs/scp/">
Options Indexes FollowSymLinks Includes ExecCGI
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
Now my hosts file
127.0.0.1 summerschoolforteensuk.com
127.0.0.1 summerschoolold.com
127.0.0.1 scpold.com
From what I can see, everything seems to be working fine. Im relativly new to working like this but poor internet speed at my office means I have to. Im guessing that there is not error here as the other two sites work fine.
Is there something Im missing if not where would I look next.
Thanks
I seem to have solved this by installing wordpress locally and importing my database and wp-content folder into the install and using the full domain for the server name and host.
Dont think this has solved my issue but its working now.