Red filename in Ubuntu CLI (Vagrant) - css

I am building a FuelPHP application running on an Ubuntu VM powered by Vagrant.
I am trying to include a CSS file on the global wrapper for all my pages, but Firebug tells me it isn't there. (the file path is correct in my <_link rel...>).
The CSS file is actually a compiled from a bunch of LESS files using an app called LiveReload for Mac.
The Apache server on my VM is set to serve from a mounted folder on my Mac, anyone who has used Vagrant should know what I mean by that.
Anyway, LiveReload dumps the CSS file in the correct place, and is populated on my Mac:
However, SSHing into the VM and examining the CSS file leads me to believe that something weird is happening. Firstly, the filename is in red (but it exists!):
Secondly, opening it with a text editor (nano in this case) shows it to be blank, despite it being full on the Mac:
So my question is... wtf is going on here? Why is it showing empty on the VM? Why is it red? Why can't Apache find and serve it?
EDIT, still struggling with this.
I added my own 'test.css' file and it loads that fine. Just not the app.css generated by LiveReload. There's something wrong on the VM. Can anyone help? It's one of those annoying things thats holding up my development.
Here's the stack trace (although i'm sure it has nothing useful in it):

If I guess right than you have a wrong mod rewrite rule which redirects your request to a php script which tries to include a file which does not exists.
So check your .htaccess file

Argh, renamed the file to appcss.css instead of app.css and it works. Changed it back, it doesn't. System musn't like that name for some reason. Annoying the amount of time i wasted, but fixed now!

Related

Django project does not work after being transferred from Windows to Mac

I'm using Django 3.1.7 on a MacBook Pro after transferring the Django project off of a Windows 10 machine. However, upon re-setting up the database and superuser and running the command pipenv sync to install all necessary modules, the server does run; but it doesn't serve any of my URLs or the CSS styles for the Admin page. I can reach the admin page at '/admin' but no other page that I've set up will display. All it gives me is my custom 404 page whenever I try to serve a page. Is there any way to fix this? Is something wrong? Where are the Admin CSS files?
python manage.py runserver --insecure
Use the --insecure option to force serving of static files with the staticfiles app even if the DEBUG setting is False.
djangoproject
I think we'd need more information... maybe the files itself.
There could be tons of things that could go wrong. Is your settings.py still pointing to the correct file paths? In views.py, did you make sure you are setting the html files in the same path? Are the html files in the right folder? Are all the Django and module versions the same? There's too much to name.
I have the same problem.
By what you are describing it happens because your file path uses either / or
One machine uses forward slash and the other backwards slash
I dont know to so use a method that work on both

MAMP Start Page Only Shows Index

I'm trying to install Wordpress on MAMP using this tutorial. When I start the MAMP server and go to the MAMP startup page, I see this index instead of a GUI. As a result, I can't access the PHPMyAdmin GUI (despite the PHPMyAdmin link) to create a database for Wordpress. Does anyone know what I might be doing wrong? I'm running OSX 10.9.5.
Try that url to access phpmyadmin
http://localhost:8888/phpmyadmin/
This is the directory listing that Apache provides in some cases. When a folder is requested, Apache looks in a folder for a file name matching the DirectoryIndex directive, which are often files such as index.php, index.html, home.htm, and so on. Since none of those exist here, the directory listing is shown.
Basically, something isn't right here with your MAMP install; either this URL is not designed to be accessed by you ever or your installation is incomplete. First, try loading http://localhost:8888 directly and see if that works any better for you. Failing that, I suggest you make a backup of any MAMP related files (databases, web pages, or configuration changes) and reinstall. One possible cause of this is if the MAMP package is not installed to /Applications/
In short, when you're using an all-in-one package like MAMP this shouldn't happen. You say that when you uninstalled and reinstalled that fixed the problem which is what I would have suggested anyway. It seems something went wrong with the installation and that should (and did) fix it.
I add the solution that helped me in the similar situation just in case someone later will face the same problem when after the Wordpress has been installed, a browser just show "Index of/" instead of the required site.
Check the following points:
There is 'index.php' file in the root folder of your project. (web server tries to open exactly this file).
If the file actually is located there, check the configuration of your web server. For example in my case my web server is Apache 2.4. After I added the directive "DirectoryIndex index.php" in the Apache configurations file (thereby saying to the server which file it should open if it received the address of the root folder) my problem was solved.

I add a line of text to my CSS file, garbage comes through the browser

I'm using Vagrant to manage a VirtualBox instance of Debian Wheezy with PHP 5.5 and nginx 1.4.4. My local environment is Mac OS X 10.9 with PHP 5.5 and Apache 2.2.24. I have a synced directory that points to my document root for this particular project.
My local machine has a VirtualHost setup that also points to the document root for this project. Therefore, I actually have two different URLs that I can point my browser to, and the same code will be executed. One URL hits the virtual machine, while the other URL hits my local Apache installation.
I've been able to edit several PHP files with no problems. I make the changes locally and they immediately show up on both the virtual machine and my local web server. However, whenever I try to edit CSS, things get bizarre. I'm trying to add a single line of CSS to a static CSS file. Something along the lines of:
.body {margin-top:50px}
When I make this change, the virtual machine goes nuts. I'm not sure if it's sending a corrupted file, or if it's just appending a bunch of weird characters at the end of the CSS file, but I can't even paste them here. I did a Charles dump of the request for the CSS file and the response looks like this:
I've looked at the file in vim through the virtual machine. I've looked at the file using multiple text editors. For the life of me I can't find anything wrong with it. When I load the exact same file through my local Apache installation, it works just fine:
Notice that the body declaration appears between button and footer, and there are no weird characters at the end of the document.
The other thing that I noticed is that my the whitespace is being manipulated at some point as well. The CSS file in question uses four spaces for indentation, but in the response from the virtual machine, the lines only have two spaces of indentation. You can't see it from the pictures because they're formatted by Charles, but I looked at the raw data. It's truly bizarre.
Do you have any idea what is causing the manipulation of my CSS file when it is being served via the Vagrant/nginx combo vs my local/Apache combo?
EDIT
I pasted some of the characters into a hexadecimal converter and it converted all the characters to question marks. I tried a binary to decimal conversion and they all turned into �, which from what I can find is "used to replace a character whose value is unknown or unrepresentable in unicode". I ran file --mime on the file and it returned rental-application.js: text/plain; charset=us-ascii. So...nginx settings maybe?
I'm having the exact same issue with JavaScript files. If I vagrant destroy and vagrant up is the only way I've found to resolve the issue so far. It doesn't make for quick troubleshooting when I have to reboot my VM between file saves.
Every method that I use to look at the file works. The only issue is when it is served through nginx, which makes me think I have some type of encoding setting wrong. It's a mostly stock setup.
More bizarre
If I mv rental-application.js rental-application.html and load the page in my browser, it comes across perfectly. The same applies if I change the name to rental-application.php. However, as soon as I change the name to rental-application.js or rental-application.css, my changes disappear and the � characters re-appear at the end of the document.
Even MORE bizarre
I can create a js file on the VM and it will load fine via the VM nginx server. If I subsequently modify the file I just created and reload it, the changes don't appear, just the garbage characters.
If I mv that file to a different name that ends in .js, the garbage character problem still persists. However, if I then cat the contents of the renamed file to a new file with the original name, all is well in the universe.
Just so if people end up here for the same issue, they have the solution on how to resolve this: you need to turn off sendfile() in your web server' settings.
For Apache: EnableSendfile off
For Nginx: sendfile off
Quick explanation: https://coderwall.com/p/ztskha
You can find more online if you need more details.
Now you can get a beer and enjoy your static file being transferred properly, not more corrupted files :)

external CSS sheet not loading to hosting

I'm having trouble making my CSS external stylesheet work in my actual hosting. It all works fine when I open the files from my Finder (I'm using a mac), but the stylesheet does not seem to load to my server properly. All other html files load fine and are visible when you visit my website in any browser,this is my website and the File Manager on my cPanel indicates that the CSS folder and external stylesheet file have been successfully uploaded for enough time that the style features should display. I tried clearing my browsing history and reopening my browser.
My link tag is and I have tried it using aswell as with just "css/socialpolarities.css". I've checked to make sure the spelling is right on the path and corresponds to the actual file.
Is the answer to just put all the style files in the public_html folder and then just change the path on all my html files? Or am I missing something?
I'm also using LiquidWeb if that means anything
The file css/socialpolarities.css seems to exist, but is void of content.
try looking at your local file to make sure it is indeed the one with the css code, then upload it to the same folder and override the original one.
You may have had an upload error.
I got it! The problem was actually that I needed to put the css file in the home directory, for some strange reason. My path from my html files definitely specified that the css files were in a css directory so I'm not sure if it's something I did wrong or whether the cPanel just sucks. Regardless, it works so I won't mess with it. Now time to copy all of my webfont files into my home directory...this is going to be messy lol.
Check your permission. They should be 755. You can search about permissions on internet. I changed the permissions and it worked fine.

CSS not formatted correctly in vagrant environment

I have vagrant setup as my local dev environment. When vagrant is up and I edit my CSS file and look at its source in the browser the new CSS I have written is not in the file and the file is now appended by loads of question marks:
��������������������������
If I do vagrant halt or destroy and then bring it back up the CSS file is fine with the new code visible and formatted correctly and no sign of the question marks. As soon as I edit it again the same things happens. Obviously I don't want to destroy and create vagrant every time I make a CSS change.
Any ideas on this?
Update: I have been told this may be to do with not having NFS installed with vagrant - I am on ubuntu and my files are within an encrypted home directory so I believe NFS doesn't work - any other solutions?
I had lot of problems with not having nfs activated on my VM
What information do you have when you run a 'ls -la file.css' on the file ?
Perhaps you can disable sendfile based on this thread:
JS and CSS files in vagrant not properly encoded when saved outside of the VM
Set enableSendFile to off in httpd.conf.

Resources