1

How to check which Webserver is Installed in Pi and How to access It From From My PC.. I Mean where will be The WWW Folder located in Pi. In windows Pc It will be There in WAMP/LAMP/XAMMP Folder

netstat -tlnp
(Not all processes could be identified, non-owned process info
 will not be shown, you would have to be root to see it all.)
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
tcp        0      0 127.0.0.1:3306          0.0.0.0:*               LISTEN      -
tcp        0      0 0.0.0.0:80              0.0.0.0:*               LISTEN      -
tcp        0      0 0.0.0.0:21              0.0.0.0:*               LISTEN      -
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      -
  • Run "netstat -tlnp" command at OS which runing on your Pi, then edit your question with the command output. – gurcanozturk Jul 6 '14 at 12:11
  • @gurcanozturk I 've Updated the Question – user40138 Jul 6 '14 at 12:18
2

You can find which HTTP server running on your Pi with in different ways.

Because we interest with HTTP server, we looking for port 80. It's default port for web services but it can be change by administrators.

with netstat command;

# netstat -tulpn | grep ":80"
tcp        0      0 0.0.0.0:80              0.0.0.0:*               LISTEN      23666/lighttpd 

with lsof command;

# lsof -i :80
COMMAND    PID     USER   FD   TYPE    DEVICE SIZE/OFF NODE NAME
lighttpd 23666 www-data    4u  IPv4 172667500      0t0  TCP *:http (LISTEN)

with fuser command;

# fuser 80/tcp
80/tcp:              23666

# ls -l /proc/23666/exe
lrwxrwxrwx 1 root root 0 Jul  6 06:38 /proc/23666/exe -> /usr/sbin/lighttpd

Then you should find the "document root" (default path for web service files). Because we don't know what web server running, there are some possibilities. I can give 3 different commands to find the document root folder for each web server. Those are lighttpd, apache and nginx.

for lighttpd;

# lighttpd -f /etc/lighttpd/lighttpd.conf -p |grep  document-root
    server.document-root           = "/var/www"

for apache;

# httpd -V | grep -i SERVER_CONFIG_FILE | cut -f2 -d'"' | xargs grep -i '^DocumentRoot' | cut -f2 -d'"'
/var/www

for nginx;

# grep root  /etc/nginx/sites-enabled/default 
root   /var/www/nginx-default;
| improve this answer | |
  • 1
    I know it's 2 years later but none of my raspbian-based Rpis have this lsof command... wierd... – unknownprotocol Sep 28 '16 at 3:31
0

As the other answers have said, you can look use netstat to look into what ports are being listened on, but you can also use service and dpkg to find put what's installed and what is running.

  • dpkg --get-selections | grep 'nginx' will output a long list of installed packages and you can pipe that into grep to filter for whatever server you're looking for.

  • service --status-all will show you the status of any currently running services/daemons. You can ask for example to start, stop, or restart any service you see there. Yu can also query it's status: i.e service nginx status.

Most of the time all installed servers will have a folder in /etc/<servername> and inside that folder you can find it's config or conf file which will tell you where in the file system the server is serving files from. Ex: Nginx's is in /etc/nginx/nginx.conf Apache's in /etc/apache2/apache2/

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.