So I have a Laravel 5.2 project on GitHub that works perfectly on my localhost using MAMP. Now I want to deploy that project in Digital Ocean. I've used a LAMP stack and configured everything (I think). Phpmyadmin is installed as well.
I followed most of the steps highlighted in this article: http://davidmyers.name/post/laravel-on-digital-ocean but some don't apply since I think its for Laravel 4 because the Laravel 5 structure is different.
I ran composer install after cloning the repository to install the dependencies
I created the .env file to include the MySQL database info on the DO Server.
I ran the following two commands to change permissions on the project folder:
sudo chmod -R gu+w www and sudo chmod -R guo+w www
Now I am able to see the public Laravel HomePage without issues:
However, when I try to access the different API routes that have been defined in the local version I have running, I get a 404 Error on the page:
Any idea what might be causing this issue?
Thanks in Advance!
I found the answer to my issue on this thread: https://laracasts.com/discuss/channels/laravel/why-do-i-always-get-a-404-error-for-any-route-i-create?page=1
Basically I needed to modify my apache settings on the conf file. My conf file was located here: /etc/apache2/sites-available/000-default.conf
I modified that file to include this:
<Directory /var/www/yoursite.com/public>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
After I modified that, the routes now work perfectly.
Sounds like a rewrite problem. Did you setup the .htaccess files correctly in the root and in the public folder of your project?
Related
I'm trying to make apache run on Linux Subsystem for Windows.
So I just installed apache and changed DocumentRoot from "/var/www/html" to "/var/www" in /etc/apache2/sites-available/000-default.conf.
This has exactly the effect I wanted it to have, namely to list all folders inside when browsing to "localhost".
My projects are located on my Windows drive in "C:/Projekte", so I created a symlink like so:
sudo ln -s /mnt/c/Projekte /var/www/projects
Now my problem is, when I browse to localhost and click on projects it runs into a loop trying to call an index.html, so the url before it breaks looks like this:
http://localhost/projects/index.html/index.html/index.html/index.html/index.html/index.html/index.html/index.html/index.html/index.html/index.html/index.html/index.html/
I would want to see the directory listing of my folders instead.
I know about the Options Indexes and FollowSymLinks which are both set, but there seems to be something else I have to set for symlinks to work as I expect.
If I create a folder instead in "/var/www" it works fine.
Does anybody know how to set this up correctly?
By accident I found out, that my issue here is related to this issue on BashOnWindows. Problem is that I used tab to autocomplete the path which automatically added a trailing slash to the end of the path. So the actual command I used to create the symlink was
sudo ln -s /mnt/c/Projekte/ /var/www/projects
Creating the symlink without trailing slash, just like in my question it works just fine.
I'm running a Yii app with Wampserver, I pulled it from a git repository so it had no assets folders, I had to manually create each one because it was throwing a CException.
Now when I load any page Yii creates some folders with random names inside my assets folders, but they're all empty. Edit: Just noticed one of the folders created is full of files, but the other is totally empty and that's where it is trying to load all bootstrap files.
I've tried deleting them again but I have the same result, also tried adding SAFE_MODE in php.ini, running wamp as admin and adding this in the apache conf:
<Directory "*/assets/">
Options Indexes FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
</Directory>
I read the 'Understanding assets' post but the only useful thing I found was:
It's important that the directory be writable by the webserver user so
that Yii can publish the resources there when needed
Yet I can't find how to do it for Wampserver
So, what am I supposed to do?
Thank You
I just found out what was going on, the application is using a bootstrap component which has an "assets" folder as well, since git was ignoring that folder it was empty and the component wasn't able to publish the files in the application assets. I just put the original component files inside that folder and the problem is now solved.
This is going to read similar to the other Trac static resource issues I found (pretty well encompassed by this SO question), but this doesn't appear to be the same issue.
I have partial (non-root) access to a server with other Trac projects, and I have the ability to create my own Trac site. The server has the following software versions:
Python 2.7
Trac 1.0
mod_python 3.3.1
So I've created and have been using the site for a few weeks, but I can't get the logo or the favicon to show up. There is another Trac project to which I have access, and to make sure I wasn't missing anything obvious I compared the trac.ini files from both projects. The relevant sections have very similar settings, e.g.:
[header_logo]
src = site/my_logo.png
[project]
icon = site/favicon.ico
and those are both sitting in their respective Trac environments' htdocs folders:
/
opt/
trac/
trac_env_1/
htdocs/
my_logo.png
favicon.ico
trac_env_2/
htdocs/
my_logo.png
favicon.ico
However, the images only appear on one site but not the other. On my site Google Chrome says:
GET https://{Intranet URL}/trac/{my_trac_env}/chrome/site/my_logo.png 404 (Not Found)
I have tried the following, all of which have been unsuccessful:
Setting the width and height inside [header_logo] to the correct dimensions
Copying the exact same images that work on the other project over to my project
Changing site/favicon.ico to /favicon.ico and /favicon.ico? (as suggested on the Trac wiki)
Running trac-admin deploy . in place, copying the images to htdocs/common, and changing the trac.ini setting to common/my_logo.png
Changing site/my_logo.png to /images/my_logo.png and matching that folder structure in my trac environment.
Making an htdocs/site/ folder and adding the logo to it (which, I know, is what other people did wrong, but I'm banging my head against the wall here).
The only thing left I can think of is Apache settings, but from what I can tell it should handle whatever Trac environments it can find in /opt/trac. In /etc/httpd/conf.d/trac.conf, it has:
<Location /trac>
SetHandler mod_python
PythonInterpreter main_interpreter
PythonHandler trac.web.modpython_frontend
PythonOption TracEnvParentDir /opt/trac
PythonOption TracUriRoot /trac
PythonOption PYTHON_EGG_CACHE /var/trac/egg-cache
</Location>
That it uses TracEnvParentDir instead of just TracEnv is the important bit, I think.
So, I am at a loss. Please, can somebody help me?
Gah, I knew I was missing something simple.
The problem was file permissions. Apache did not have read access to my Trac environment, so a simple chmod -R a+rX /opt/trac/trac_env_2 solved it.
I guess that's another answer to the "My static files won't show up in Trac" question:
Don't make an actual folder named "site" in your Trac environment; site/my_logo.png will look in trac_env/htdocs
Make sure your server knows where to find your Trac environments. Both mod_python and mod_wsgi settings for this are easily found.
Make sure your server has read access to your particular Trac environment (chmod a+rX to give directories-only execute permission)
Just posting here in case anyone else runs into a similar issue.
I have a project with several sub-directories. Everything works just fine, except if I try to access files inside the /root/javascript directory, I get a 404. The files do in fact exist, and I am in fact typing the path correctly. If I simply rename the directory I can then access the files. Rename it back, and I get the 404 again. VHost file works fine. No .htaccess files involved.
Apache version: 2.4.9
OS: Ubuntu 13.10
After much searching and trying different things, here's what the problem came down to:
By default, Apache 2.4 on Ubuntu enables a config file called javascript-common, which redirects any requests to files inside /javascript (that is, a directory at the root of your project called 'javascript') to /usr/share/javascript.
Solution 1
Use the following command to disable the javascript-common configuration file:
a2disconfig javascript-common
Solution 2
Add your JavaScript files inside that /usr/share/javascript directory. That way Apache will actually find those files and no 404 will be returned. One benefit of doing things this way is that you won't need multiple copies of the same files (jquery.js, etc.js) that multiple projects use...
Solution 3
Delete the directory /usr/share/javascript, and create a symbolic link that points to your project's /javascript directory. Keep in mind that if you have more than one project (vhost file), they will all serve from the same JavaScript file from the original project. In other words, this is probably not the best solution...
The a2disconfig solution didn't work for me, but then through some searching, I realized that the javascript-common is something that can be uninstalled.
So I fixed the problem by removing javascript-common:
sudo apt-get remove javascript-common
I'm not sure the point of this package, or why it would be installed automatically, but I'm glad that my javascript files are loading again!
I am running Ubuntu 14.04.1 LTS with the lamp-server bundle
Encountering the same problem, I found a similar answer resolved it.
sudo a2disconf javascript-common
sudo service apache2 restart
After the a2disconf (and note it is apparently now a2disconf and not a2disconfig)
I did get a message to execute "sudo service apache2 reload"
the reload did not resolve the issue... thus the restart
as an aside -- I cannot imagine what the developers were thinking when they loaded this little gem -- some of my javascript files might be viable across domains... but certainly not all !
You could just override /javascript alias in your .conf to reflect what you want:
Alias /javascript /my_custom_dir
I just installed a copy of Trac 1.0 using easy_install-2.6, but am having trouble deciphering the "Deploy Trac" section of the Install documentation.
After issuing easy_install-2.6 Trac=1.0, I then created my environment as so:
trac-admin /www/virtualhosts/trac initenv
Next, I set permissions:
chown -R apache.apache /www/virtualhosts/trac/
My /etc/httpd/conf.d/trac.conf file looks like this:
<Location /trac>
SetHandler mod_python
PythonHandler trac.web.modpython_frontend
# "/www/virtualhosts/svn/trac" is the folder you gave to trac-admin initenv earlier
PythonOption TracEnv /www/virtualhosts/trac
# "/trac" is the same as the Location above
PythonOption TracUriRoot /trac
# "/tmp" should be some writable temporary directory
SetEnv PYTHON_EGG_CACHE /tmp
# "trac" can be any string, but must be the same for all
# Trac instances on the same Apache install
PythonInterpreter trac
</Location>
<Location /trac/login>
AuthType Basic
AuthName "Trac User"
AuthUserFile /www/virtualhosts/trac/conf/trac.htpasswd
Require valid-user
</Location>
I reloaded the httpd config with:
service httpd reload
Seeing no errors, I opened up the Trac installation by pointing my browser to http://my.site/trac/. The Trac application loads OK.
In the documentation, there is a section on Deploying Trac. This is where I am a little fuzzy. Is my installation of trac not already deployed? Or is this an additional step?
Second, under Mapping Static Resources, the documentation explains how to alias two directories: chrome, and site. At the beginning of the Apache ScriptAlias example the docs provide this command:
trac-admin /var/trac/env deploy /path/to/trac/htdocs/common
I do not have /var/trac/env on my system. I cannot find where this directory was created, unless it was supposed to have been set up during initial installation of Trac 1.0.
Can someone explain what needs to happen to get the chrome/site directories created? I understand these are aliased with Apache, but I'm not getting the command I quoted right above, where trac-admin uses something in /var/trac/env. That directory doesn't exist, so I am unable to issue that deploy command.
I will need the chrome/site aliases working in order to install a plugin.
For one thing, don't use mod_python. It's not being maintained any longer and it has some known issues. Setting up your server to use WSGI will give you a much better experience.
Regarding the deploy command in particular, the Trac documentation could indeed be a bit more clear. I believe both of those directory paths are just placeholders and don't have anything to do with the paths used in the documentation up to this point. They're merely there to match up with the paths used in the config file examples that follow it.
Based on the information you gave and my notes from when I set up my Trac system, try this command instead:
trac-admin /www/virtualhosts/trac deploy /www/virtualhosts/trac/deploy
That should create a deploy subdirectory in your Trac directory and populate it with "cgi-bin" and "htdocs" subfolders. From there, simply modify your Apache config files depending on what type of deployment you are doing (more details on the FastCGI and WSGI pages).
/var/trac/env was meant /path/to/trac-env, that translates in your case to /www/virtualhosts/svn/trac - the real place of your "Trac enviroment" on disc.
The deploy directive actually creates new directories and extracts static content into it, Trac's als well as Trac plugin resources as you already know. You may call it repeatedly, whenever you update trac/htdocs content. And you can even use one such trac/htdocs/common for multiple Trac envs served by the same Trac version. Just make sure to check directory permissions to ensure read access from the web-server process.
chrome/site is not a real directory at all, just a reference to directory <trac-env>/htdocs.
Still there are some plugins, that need to get unpacked to work correctly, so you'll need to setup a cache directory too.