apache2 not serving css file despite showing file in directory - html

I have a website I am trying to host, but for whatever reason, apache2 is refusing to serve the css file I have for my website. I have not change any settings and everything is completely default. I installed apache in the past 2 weeks so everything is clean and fresh.
All I did was copy all the files generated by jekyll from the _site folder and put them into /var/www/html on my server. now, when I go to my website, I can see all the content and the html loads correctly. The links work, images work. but there is no css styling available.
Because the default settings on apache arent that good, i can browse the folder contents. for example, my css file is store in /var/www/html/assets/css/style.css. So, when I access the website by going to https://mywebsite.com/assets/css, I can see the file structure and apache shows that I have a css file in there. but, when I try and click on that file, I get a
Not Found.
The requested URL was not found on this server.
----
Apache/2.4.52 (Ubuntu) Server at xxxx.com Port 443
All other files can be browsed in the folder structure and every file appears to be present, its just the pesky css file that will not load.

Related

Downloading file from ubuntu server through html

I have my domain pointing at a ubuntu server hosted by amazon ws, and I have my index.html file that gets loaded when someone makes a request to my domain, in the same folder of that index.html file I have another file, and I would like to make it possible to download it from my website. How can I achieve that? I tried with an iframe tag, and giving it src="./myfile.jpg" but the server tries to look for it at www.mydomain.com/myfile.jpg and it can't find it there. Can anyone give me any suggestions?
Btw my files are inside /var/www/html folder, which from what I understood is the default folder for public files on ubuntu.

Copy website folder and contents to Apache web server

I just started setting up Apache web server to try and test a website I am building. After installing LAMP (I'm on Ubuntu 16.04, if that's important), I copied a folder of HTML and CSS code that I had to test. Here is the folder's contents:
Main folder: testsite
Subfolders: articles, images, CSS, HTML, scripts
Contents:
articles -> .docx files
images -> .png files
CSS -> .css files
HTML -> .html files
scripts -> .py files, but one .html file too
When I went to test the Apache web server, it gave a 404 not found. I'm absolutely clueless as to what could be the answer. I tried renaming the maincode.html file that I had to index.html and putting it in the testsite folder, but it didn't change anything. Is there anything I need to do to fix this?
Here's a screenshot of the 404 Not Found page, with the Developer Console open (in Chrome)
I'm not sure what other information I need to provide, but I'll gladly give any info you need.
Make sure your testsite's conf file has the DocumentRoot property set to the path to your testsite folder. The conf file is probably /etc/apache2/sites-enabled/000-default.conf.

Duplicated page elements

I am working in boonex dolphin 7.0 in my site when I am taking photos module by this URL:
http://www.sportzshowcase.com/sports/m/photos
Page getting duplicated, Is that htaccess problem ?
copy the htaccess file from from original dolphin base folder and paste in your localhost project and run project......otherwise change apache httpd.cof file setting(LoadModule rewrite_module modules/mod_rewrite.so)

Aptana Studio 3 preview problems with absolute path

I have this structure for my project:
Root Directory
|-css folder
|-style.css
|
|-it folder
|-index.html
If I try to include css file with:
<link href="/css/style.css" rel="stylesheet" type="text/css"/>
from index.html, aptana preview and also internal server can not find style.css.
Why is this?
In my remote server it works perfectly and I do not want to use a relative path.
In terms of the "why", the problem you are having is related to how your development server is setup versus your production server.
Assuming a standard setup, your production server will receive requests for a domain (i.e., http://mysite.com) that is, for lack of a better word, mapped to a folder on your server (i.e, a request to http://mysite.com will be mapped to a folder, /var/www/mysite, on your server).
So, when you link to a style sheet with /css/style.css, your (production) sever immediately goes to the /var/www/mysite folder and starts looking for the css folder, file and so on. No problems with that, as you point out.
Your development machine, however, is serving up pages locally and has a different directory structure for mapping to files and folders.
When I open an HTML page in my Aptana project and hit the preview button, Studio loads http://127.0.0.1:8020/mysite/public/404.html (note how the first folder after the IP and port is mysite). To load the absolutely pathed CSS file, the local server is actually looking for http://127.0.0.1:8020/css/styles.css but it needs to get to http://127.0.0.1:8020/mysite/css/styles.css.
The initial "/" in your link (/css/styles.css) tells the server to go to the root directory of the server and start looking for the folder and files from that point ... but there is no css folder in the local server's root directory. It lives in /mysite/css/styles.css and that's why fskreuz suggests relative paths and using "../css/styles.css" instead.
Personally, I prefer absolute links (but that's just a personal preference and not in any way a challenge to or comment upon fskreuz's response). However, my local development setup is conducive to using them because I setup virtual hosts for the sites I work on. Using Apache, I setup a virtual host for each of my projects. With this, I can load something like http://dev.mysite.com in any browser on my computer and test my site/app in a way that makes it mirror my production setup.

MAMP htdocs phpinfo

I am trying to get a simple phpinfo() to print out on my local server (using MAMP). I made a new directory in /Applications/MAMP/htdocs (php_sandbox) and put a file in there named my_phpinfo with only phpinfo() in it. How can I view the contents of this file in my web browser?
Is it also advisable if I set the Apache document root to be in my home directory/sites? I will be mainly using this local server to test/host some small sites.
Thanks!
visit in your browser localhost/my_phpinfo/index.php assuming you named the file with
<? phpinfo();?> is in index.php. Also, make sure you are editing the correct php.ini in your MAMP directory by checking your mamp prefs and seeing what version of php MAMP is using.
Your in the right folder by default from what I remember. MAMP runs apache on port 8888 by default. You should be able to go to http://localhost:8888/ You can also get to this page via the control panel (should have a button to open home page). This page will also show you've configured MAMP's Apache to run on a different port.
Whatever you name your file; you'll want to give it a .php extension, so if you file is named my_phpinfo, add a .php so it becomes my_phpinfo.php. Make sure you function called is wrapped in php tags like so
<?php phpinfo(); ?>
If this file is directory in the htdocs folder you should be able to go to http://localhost:8888/my_phpinfo.php and get the PHP Info page.
As far is moving the directory. I normally do. Especially b/c it makes upgrading MAMP a little easier (already have to worry about MySQL). You might have to tweak the file permissions just a bit to make sure it runs correctly. I believe though you should be okay since it is running as your User.