I installed apache2 and now I wont use nginx now. I could reached my html page on local network on

The html file is saved in var/www/html/index.html. Now I installed nginx. I try to uninstall apache by these commands:

  1. sudo apt-get --purge remove apache2
  2. sudo apt-get autoremove
  3. sudo rm -r apache2

I thought, now is my apache server uninstalled but when I reach I reach my old html page saved in /var/www/html/. I googled that nginx default public www location is /usr/share/nginx/html/.

My questions:

  1. Why do I reach the html created for apache?
  2. How can I be sure I uninstalled all apache packages, directories etc.?
  3. Can I just delete the www directory in /var/ ?
  4. How can I reach the html page saved in nginx default public www location?

    sudo lsof -i:443
    nginx 543 root 7u IPv4 9117 0t0 TCP *:https(LISTEN)
    nginx 544 www-data 7u IPv4 9117 0t0 TCP *:https (LISTEN)
    nginx 545 www-data 7u IPv4 9117 0t0 TCP *:https (LISTEN)
    nginx 548 www-data 7u IPv4 9117 0t0 TCP *:https (LISTEN)
    nginx 549 www-data 7u IPv4 9117 0t0 TCP *:https (LISTEN)

    sudo lsof -i:80
    nginx 543 root 6u IPv4 9116 0t0 TCP *:http(LISTEN)
    nginx 544 www-data 6u IPv4 9116 0t0 TCP *:http (LISTEN)
    nginx 545 www-data 6u IPv4 9116 0t0 TCP *:http (LISTEN)
    nginx 548 www-data 6u IPv4 9116 0t0 TCP *:http (LISTEN)
    nginx 549 www-data 6u IPv4 9116 0t0 TCP *:http (LISTEN)


upstream php-handler {  
    #server unix:/var/run/php5-fpm.sock;  
server {  
    listen 80 ;  
    return 301 https://$server_name$request_uri;  # enforce https  

server {  
    listen 443 ssl;  
    ssl_certificate /etc/nginx/cert.pem;  
    ssl_certificate_key /etc/nginx/cert.key;  
    # Path to the root of your installation  
    root /var/www/owncloud;  
    client_max_body_size 1000M; # set max upload size  
    fastcgi_buffers 64 4K;  
    rewrite ^/caldav(.*)$ /remote.php/caldav$1 redirect;  
    rewrite ^/carddav(.*)$ /remote.php/carddav$1 redirect;  
    rewrite ^/webdav(.*)$ /remote.php/webdav$1 redirect;  
    index index.php;  
    error_page 403 /core/templates/403.php;  
    error_page 404 /core/templates/404.php;  
    location = /robots.txt {  
        allow all;  
        log_not_found off;  
        access_log off;  
    location ~ ^/(?:\.htaccess|data|config|db_structure\.xml|README) {  
        deny all;  
    location / {  
        # The following 2 rules are only needed with webfinger  
        rewrite ^/.well-known/host-meta /public.php?service=host-meta last;  
        rewrite ^/.well-known/host-meta.json /public.php?service=host-meta-json last;  
        rewrite ^/.well-known/carddav /remote.php/carddav/ redirect;  
        rewrite ^/.well-known/caldav /remote.php/caldav/ redirect;  
        rewrite ^(/core/doc/[^\/]+/)$ $1/index.html;  
        try_files $uri $uri/ index.php;  
    location ~ \.php(?:$|/) {  
        fastcgi_split_path_info ^(.+\.php)(/.+)$;  
        include fastcgi_params;  
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;  
        fastcgi_param PATH_INFO $fastcgi_path_info;  
        fastcgi_param HTTPS on;  
        fastcgi_pass php-handler;  
   # Optional: set long EXPIRES header on static assets  
   location ~* \.(?:jpg|jpeg|gif|bmp|ico|png|css|js|swf)$ {  
        expires 30d;  
        # Optional: Don't log access to assets  
        access_log off;  
  • Is the Apache service still running? It should have explicitly been stopped when you uninstalled it, but not all packages do so. Try ps -AF | grep apache2 and see if it is listed. Note you'll see one entry for this command - you're looking for additional entries. – garethTheRed Jun 26 '16 at 8:19
  • This is listed after ps -AF | grep apache2 - pi 5883 2890 1 1067 1960 0 08:21 pts/0 00:00:00 grep --color=auto apache2 – dorinand Jun 26 '16 at 8:27
  • 2
    sudo lsof -i:80 will show you what's listening on port 80 (assuming you're not using HTTPS - change the 80 to 443 if you are). – garethTheRed Jun 26 '16 at 9:10
  • It is possible that the default configuration your distribution (Debian? Ubuntu?) ships sets the default location for files to /var/www/html/ for nginx, too. – Ulrich Schwarz Jun 26 '16 at 12:50
  • @garethTheRed actually, I am not sure which port I should listen. I use configuration from this page https://pimylifeup.com/raspberry-pi-owncloud (point 10). There is configuration where is port 80 and also port 443. Som when i use lsof -i:80 and lsof -i:443 there is almost similar entries. I cannot see where is in configuration specified the default public www location. – dorinand Jun 27 '16 at 6:31

Your Answer

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

Browse other questions tagged or ask your own question.