1

I have a RPi running nginx as a web-server (default installation except /var/www as default directory), but I can only access it inside LAN.

I followed this tutorial and in sites-available I created a file with the following code:

server {
 listen 80;
 root /var/www;
 index index.php index.html index.htm;

 location ~ \.php$ {
  fastcgi_pass unix:/var/run/php5-fpm-sock;
  fastcgi_index index.php;
  include fastcgi_params;
 }
}

What do I need to do to make it accessible from outside my network?

justanotherhobbyist
  • 635
  • 3
  • 10
  • 19
  • forward port 80 to the PI. Please search this Q&A as it has been answered a million times across all the sites. – Piotr Kula Oct 24 '13 at 10:33
  • I actually have port set to 80, atleast in the sites-available directory, I'll add that to the question. Where do you mean I need to set the port? I'm sorry if my question is repetitive but I couldn't find the answer by searching. – justanotherhobbyist Oct 24 '13 at 10:49
  • http://raspberrypi.stackexchange.com/a/9764/894 Please concnetrate on the part that is highlighted as What is port forwarding? near the bottom of the answer. – Piotr Kula Oct 24 '13 at 12:02
  • @ppumkin Actually that question is far from what I'm asking, a relevant link in the bottom of an answer to a completely unrelated question does not make this a duplicate of that question. That being said I still appreciate the link as it included a good understanding of what port forwarding is, why we use it and how it works. But I still don't know how to apply it to my RPi, I'm new to linux and don't even know where to start, I will however start by making sure the router is configured correctly. – justanotherhobbyist Oct 24 '13 at 12:32
  • The first problem is that you still think that is all unrelated. So in case you missed it while reading the articles that were linked... You need to log into your rootuer, forwards port 80 TCP from WAN to port 80 of RaspberryPi. Then use whatsmyIP, use a remote computer or 3G on your phone and type it in... Your Pi Site should show. You can use Dynamic DNS to update your IP on the global network. Go and read the links... again. slowly. – Piotr Kula Oct 24 '13 at 12:51
  • I understood that part, still not a duplicate of "how to communicate with my RPi", a relevant answer doesn't make a duplicate question. Pears and apples are both fruits, but not the same fruit, get it? That's all I said, I know now the problem might be on the router, which is a bigger issue in itself since it's hotspot from the phone. – justanotherhobbyist Oct 24 '13 at 12:53
  • I quote your comment "possible duplicate of Remote communication with home server – ppumkin 52 mins ago". – justanotherhobbyist Oct 24 '13 at 12:56
  • Yea. I discuss how to enable connecting to FTP(21), SSL(445) and Web server(80) form the internet. Also describe how to use DynDNS.- I cannot tell you how to login and setup your router. – Piotr Kula Oct 24 '13 at 12:59
  • You're misunderstanding me, I'm not complaining about the answer man, the questions are not the same. Even though the answer was spot on, the questions are NOT duplicates. Not even close. – justanotherhobbyist Oct 24 '13 at 13:00
  • @hustlerinc This is not exactly a duplicate of that other question, but the brief answer mentions what you need to do: forward ports on your NAT router to your pi. You should set a static IP on your pi, otherwise things could break if your DHCP lease is not extended. If netstat -tnalp | grep :80 shows 0.0.0.0:80, then nginx is configured well enough to allow people from your LAN to communicate with it. Setting up port-forwarding is different for every router, but it often boils down to logging in to the configuration page and looking for Application/Port forwarding. – Lekensteyn Oct 24 '13 at 13:25
  • End of the day it answers your question no matter how you asked it. It is similar in context you just did not know how to ask the question. Its a learning curve.. I hope you sort everything out. – Piotr Kula Oct 24 '13 at 13:51
  • Although the duplicate is not the best Q&A on this topic, ppumkin is right -- this is still the same question. Whether it involves nginx or not is irrelevent. The reason we don't have the best Q&A on this site is because it is not at all a pi specific question, and people who recognize that will also have recognized it is a topic which has been done to death on-line, and hence not bother to answer it here. You are asking, "How do I access my linux box from outside my home LAN?" – goldilocks Oct 24 '13 at 18:48
  • ...So do some basic research on that, and if there is something you don't get, ask a question specifically about which bit. This is all much better dealt with on either U&L http://unix.stackexchange.com/ or S.U. http://superuser.com/ I say that for your benefit: if you actually want timely, knowledgeable assistance, recognize those places have many times the number of users here who will understand what you are after. But FIRST do research along the lines I mentioned and hone your question, or you will just be reading the same thing over and over again ("duplicate"). – goldilocks Oct 24 '13 at 18:52

0 Answers0