I am attempting to set up an AMP stack in order to do some basic web design with HTML 5, PHP, CSS, Apache, etc. I have done this on a PC but I am having trouble setting it up on my new Mac. I am trying to follow these steps (http://coolestguidesontheplanet.com/get-apache-mysql-php-and-phpmyadmin-working-on-osx-10-11-el-capitan/) but at the end of the first set of instructions I can't get the files to show and am getting a 403 error. Can someone please point me in the right direction or give me a good resource. Thank you.
Here is my current permissions on the file:
total 16
-rw-r--r-- 1 root wheel 96 Jan 10 13:39 Guest.conf
-rw-r--r-- 1 root wheel 132 Jan 20 15:52 username.conf
The way I found easiest was to do the following:
cd /filepath/to/thing/you/want; php -S localhost:8000
and then visit localhost:8000 on your computer.
Hoped this helps, as this is my first answer on StackOverflow.
Related
I am creating a website using HTML, CSS and js with java for server side. I need to run it on localhost.
Extra info: I am using mac os x 11 (el capitan)
I have already tried python and node.js but it clashes with java
So i need a technology that won't clash with java and will help me localhost on mac
IIRC macOS comes with PHP preinstalled, and PHP has built-in web-server which should be enough for serving static content.
So, open Terminal.app and then:
cd your/project/dir
php -S localhost:8080
After than you can navigate to http://localhost:8080/ and see your site in the browser (given you have index.html in your project, otherwise there will be "Not Found" message).
There are more advanced and/or less terminal-oriented ways, of course, but since you already tinkering with python and node, another terminal command should not be a problem.
BTW, you might want to look at that terminal window from time to time, as it outputs nice log of what things were requested from server. Good if you want to check for invalid references, 404 errors, etc. Here is a sample output:
$ php -S localhost:8080
PHP 7.3.6 Development Server started at Sat Jun 22 20:00:28 2019
Listening on http://localhost:8080
Document root is /private/tmp/test
Press Ctrl-C to quit.
[Sat Jun 22 20:00:32 2019] [::1]:51640 [200]: /
[Sat Jun 22 20:00:32 2019] [::1]:51641 [200]: /style.css
[Sat Jun 22 20:02:35 2019] [::1]:51670 [404]: /oops.html - No such file or directory
As you can see, root folder (/, which was translated to index.html in my case) and a stylesheet (style.css) were requested and successfully delivered (code is 200). But non-existent file oops.html resulted in error (code is 404).
You can use caddy
Install: brew install caddy
To serve static files from the current working directory, run:
caddy file-server --browse --listen :2015
Caddy's default port is 2015, so open your browser to http://localhost:2015.
Since some days, my website won't load on Safari nor Chrome on Mac OS X (at home nor on my clients computers). It's working well on Firefox (Mac OS & Windows) and IE / Edge, but not Chrome (Windows).
It was well working before that and was not updated since weeks.
I'm facing this error on Safari
Failed to load resource: The operation couldn’t be completed. (kCFErrorDomainCFNetwork error 303.)
And this one on Chrome
Failed to load resource: net::ERR_SPDY_PROTOCOL_ERROR
It seem's to be related to HTTP/2 but I don't really know what is the problem.
I saw that a workaround is to clear the cache and cookie.
I did and it works on Chrome the first time I load the website, but when I navigate to another page, the error appear again.
I also flush opened socket without effects.
On Safari, flushing the cache and cookie has no effects.
My hoster (OVH) tells me that the problem is in my code but I cannot figure out where could be the bug.
Do you have any clue about that ?
Thanks a lot
We have had a problem with nginx and HTTP/2 which resulted in the same error in Safari and a similar error in Internet Explorer.
When we tweaked the nginx buffers to be:
http2_max_field_size 16k;
http2_max_header_size 128k;
the issue was gone.
My problem was disappearing after reloading the page. So it always shows the error on the first load after nginx reload.
Error log shown:
2018/10/21 06:26:54 [crit] 9439#9439: *54 open() "/var/cache/nginx/proxy_temp/2/01/0000000012" failed (13: Permission denied) while reading upstream, client: 37.9.113.93, server: anvileight.com, request: "GET /ar/ HTTP/1.1", upstream: "http://unix:/run/a8/gunicorn.sock:/ar/", host: "anvileight.com"
My problem was that nginx has directive:
user deploy deploy;
and indeed, permissions on that folder were incorrect:
ll /var/cache/nginx/proxy_temp
total 40K
drwx------ 102 www-data www-data 4.0K Jan 6 2018 0
drwx------ 102 www-data www-data 4.0K Jan 6 2018 1
When I changed it to
user www-data www-data;
problem has gone
The problem is a result of Safari holding too much local data for the site in question and failing to deal with that correctly. I use archive.org a lot so I had lots of LocalStorage and Cookie data for that site. The fact that this data is only in my main browser Safari and not in any of my other browsers explains why they could browse the site just fine.
So, the solution:
Go into Safari > Preferences > Privacy
Search for the affected domain name (for me this was "archive.org")
Click Remove
The problem goes away!
Here's a video showing the problem before and after: https://imgur.com/gallery/d1P1FCi
This suddenly started happening for me when the files were referenced on my local in a parent directory. Solution was to move to child directory.
Can someone please explain with clear step by step instructions to a noobie, why is my console giving me these errors for some of my files on a project? I usually get them for external style sheets sometimes images and external .js documents.
Makes no sense to me.
Console shows Error: 403 Forbidden for each of them...
My noobie intuition says something is not right with my permissions for my sites directory or something among these lines. I dont know how to check
If you are using a LAMP stack for web server then you can face that problem.
First check the permission of all the files in the subsequent directory -
Let say that these are four external js in your html file like as :-
<script src="/js/file1.js"></script>
<script src="/js/file2.js"></script>
<script src="/js/file3.js"></script>
<script src="/js/file4.js"></script>
and you are getting errors for file1.js and file2.js then goto the js directory and check their permissions :-
user#host js $ ls -la
total 188
drwxrwxr-x 2 user user 4096 Jul 19 01:51 .
drwxrwxr-x 6 user user 4096 Jul 19 01:39 ..
-rw-rw-r-- 1 user user 55258 Feb 13 2014 file1.js
-rwxrw-r-- 1 user user 55258 Feb 13 2014 file2.js
-rwxrw-r-- 1 user user 55258 Feb 13 2014 file3.js
-rw-rw-r-- 1 user user 55258 Feb 13 2014 file4.js
-rw-rw-r-- 1 user user 29110 Feb 13 2014 bootstrap.min.js
If required change their permission with chmod and chown command.
I'm following the instructions from here
http://dev.mysql.com/doc/refman/5.6/en/creating-ssl-certs.html
But at the end of it, I get the following
[root#thor newcert]# openssl verify -CAfile ca-cert.pem server-cert.pem client-cert.pem
server-cert.pem: /C=GB/ST=Berkshire/L=Newbury/O=My Company Ltd
error 18 at 0 depth lookup:self signed certificate
OK
client-cert.pem: /C=GB/ST=Berkshire/L=Newbury/O=My Company Ltd
error 18 at 0 depth lookup:self signed certificate
OK
How can I go about debugging this? I'm a bit confused, since following these instructions worked a couple days ago, and I can't get it to work again. I've tried this as both a user account and root.
Thank you.
-Nick
Edit: Using CentOS 5.7 and MySQL 5.5.21
Well, this is embarrassing. I think the errors were because I created the key myself. I don't know why I wasn't getting the errors before.
I thought the errors were a problem because mysql could not read my certs. It turns out SELinux was preventing mysql from reading the certs. I used this to figure out SELinux http://wiki.centos.org/HowTos/SELinux, and in the end, just moved to certs into a sub directory of /var/lib/mysql
i am asked to implement jsp file and given instruction on how to set all mysql,tomcat and all.
i did follow everything however when i open http://localhost nothing happened. only error to connect page of the browser. i'm assuming my webserver is having a problem and still not up.
in the instruction, i was asked to run this command to check if it is up:
ps –ef | grep tomcat
and the example shows that im suppose to get something like this :
http://tinyurl.com/7yvmm9q
but i only got this:
root 2319 2297 0 15:58/0 00:00:00 tomcat
i dont get the rest of the lines as im supposed to get in the example given. what could be the issue?
I'd firstly check if tomcat listens on 80 port. You can find this by typing lsof -i - here you will see if tomcat is listening on any port.