I have made some web sites using Symfony 4 that work using the PHP server on my local machine.
When I FTP the Symfony project-directory to my 1and1 Linux web host I can not get the web sites to show up in my browser. I have tried to implement the guidelines on the Symfony documentation for doing this.
In the example below I used the symfony-demo project. I did the following:
composer create-project symfony/symfony-demo
this looked fine on my browser running on the PHP server on my local machine.
composer require symfony/apache-pack
Edited .env: APP_ENV=dev to APP_ENV=prod. Added the code from Apache with mod_php/PHP-CGI on Symfony website to .htaccess:
<VirtualHost *:80>
ServerName domain.tld
// etc etc
</VirtualHost>
Used FileZilla to upload symfony-dir (over 11000 files) to 1and1 server
Looked at www.my-web-sites/symfony-demo
I just get a page with adverts which is what happens when there is nothing there.
The symfony-demo directory is there and has files in it according to FileZilla
I know I am quite a long way from understanding this and there may be several issues I need to address but googling and reading the documentation does not seem to be taking me forward at this point. Any pointers would be great.
Related
I wanted to host a couple of websites (and apps) on the same VPS, so my idea was to have it like this:
Site 1
- HTML content only
Site 2
- PHP and HTML content
Site 3
- Java / SpringBoot app
Site 4
- Python app
Site 5
- Java / SpringBoot app
So I got the smallest pack on DigitalOcean, and thought I would start with Apache. Note: I configured the OS already, and tested basic functionality (see more info below)
I installed Apache, configured it to work with my domain (an actual one, not from hosts) and it loaded the basic HTML page. Before I did this, I tested my-domain.com:8080 and it showed the Apache Admin page, all fine. Unfortunately, now after adding my first VirtualHost (and deleting the default one), my Admin page is not accessible anymore (getting a timeout). I also used Let's Encrypt to test how SSL works.
The current state of sites-enabled:
000-default: NOT ENABLED, doesn't work even if enabled
my-domain.com: ENABLED, working with SSL, redirects to SSL by default
my-domain2-from-hosts-file.com: ENABLED, not working, redirects to the default domain
Ideally, I'd like to have a different VirtualHost/domain for each WAR deployed, but let's get the admin/manager page working first.
What could I be doing wrong? I can post logs and config if needed.
Turns out firewall was the one to blame. Port 8080 became blocked after I added Let's Encrypt SSL using their script, so... that's weird.
Is there a way to rewrite a URL in a local project to look like web page?
For example I have project with url
localhost/site
I'm tryin' to rewirite this to:
www.site.com
or
site.com
That project has subpages, and it would be good if it worked like
site.com/subpage.php
I'm trying for an hour but I'm really htaccess noob.
I work with VertrigoServ and mod_rewrite works fine with some examples which I tried in other projects.
The issue is not with rewrite. To make a local page appear to have a more conventional domain you need to tell your browser that the conventional domain is found on your local webserver.
The simplest way to do this is by editing the hosts file on your OS. On *nix based devices it's usually /etc/hosts, On windows it's usually C:\Windows\System32\drivers\etc\hosts. You will need elevated privileges to edit the file.
Add a line to the end of the file that maps the domain name to your local ip address like this:
127.0.0.1 www.site.com
Close an reopen your browser and visit www.site.com, you should see it is loading the page from your local webserver.
Chances are, you are still seeing the same page as if you view localhost site. To make it load your code you need to change the DocumentRoot in httpd.conf for your apache install to match the directory where your code is.
A preferable solution may be to use Name Based Virtual Hosting, this allows multiple web sites to share the same IP address. Searching 'apache VirtualHost examples' should give you plenty of resources for this. Make sure that NameVirtualHost *:80 is also enabled in order for this to work.
Sorry if I used the wrong terminology, I'm really new to web development/server stuff outside of Wordpress. I just made a DigitalOcean server and followed a bunch of tutorials to get it setup. I got my LAMP stack setup, but I got to the point in the tutorial where I created a quick php page and added it into /var/www as info.php. But when I go to my server IP/info.php, it couldn't find the page. It was only able to find the page when I moved it inside of /var/www/html which also contained index.html. My question is, what makes the browser/server look inside of html for files instead of /var/www?
My best guess is some apache config file that I'm not familiar with but I really have no idea.
Look in your apache httpd.conf file, most likely in /etc/httpd/conf on your server, for this command:
DocumentRoot "/var/www/html"
I'm running apache 2.2.24 on Max OS X 10.9.1. Currently, we have a network drive that we access all of our Git repos on at /Volumes/GitWebsites. I would like to configure Apache to serve our PHP based repos from that directory. So, localhost (or 127.0.0.1)/phpsite1/ or /phpsite2? etc. will serve sites from /Volumes/GitWebsites/phpsite1/ or /phpsite2/ in the browser. My two questions are:
Do I simply modify the server root or do I need to use the mod-alias in the httpd.conf file?
What are the permission setting I need to in order for apache to access /Volumes/GitWebsites ?
I've done configuration changes like this in IIS 7.5 and set up a NodeJS dev environment but still new to make large scale changes to Apache. Thanks for any help given.
If you are happy with serving the contents of /Volumes/GitWebsites as it is then it should be fine to point the document root at it. It's also makes it easy to add sites later.
However this could be troublesome later if you want to manage php configuration later on for the sites separately.
I have a site I developed locally for a client. They have an existing live site (at www.livesite.com). I want to move the developed site to their server, but I want to test it on their server before it's live.
I thought I'd install the site in a sub directory on their server (www.livesite.com/dev), and then using my hosts file, make my browser think it's viewing the final live URL (www.livesite.com).
However, I've tried various combination of things in my hosts file, and I can't seem to get it to work. The server ip followed by the domain / sub-domain.
I'm running on MAMP on OSX. Anyone have experience with this?