Results 1 to 9 of 9

Thread: Localhost URL without username

  1. #1

    Default Localhost URL without username

    Hi, I'm beginning with openSUSE and basically even with Linux and I installed LAMP according to the instructions here https://en.opensuse.org/SDB:Linux_Apache_MySQL_PHP . Now I would like to know, how can I use the URL address without mine username, just like http://localhost. I don't like something as http://localhost/~username/someFile.php. Is any options to change it?

    Regards Draffix

  2. #2
    Join Date
    Jun 2008
    Location
    Netherlands
    Posts
    25,942

    Default Re: Localhost URL without username

    What you do not want is not even switched on by default IIRC.

    Your web pages should go into /srv/www/htdocs and there is also a /srv/www/cgi-bin if you need that. IIRC that is already in the deafult Apache configuration, thus not much to change there.

    My advice is to use a seperate user for maintaining your web server (not any "normal" end-user). Make that user member of the group www and see that all inside /srv/www is owned by that user and the group www. When you then see that all there is readable for the group www, your http deamon (which runs under group www) will be able to read and thus to serve them.
    Henk van Velden

  3. #3

    Default Re: Re: Localhost URL without username

    Quote Originally Posted by hcvv View Post
    What you do not want is not even switched on by default IIRC.
    I think it is, at least in the openSUSE packages, but it's been a while since I installed apache2 from scratch.

    My advice is to use a seperate user for maintaining your web server (not any "normal" end-user). Make that user member of the group www and see that all inside /srv/www is owned by that user and the group www. When you then see that all there is readable for the group www, your http deamon (which runs under group www) will be able to read and thus to serve them.
    You could change the DocumentRoot in apache's config to point to a user's home directory or subfolder.
    But I would suggest you create a Virtualhost for this instead of changing the default supplied httpd.conf.
    You can do this with YaST btw (but editing the config files directly works as well), see here:
    openSUSE 12.3: Chapter 20. The Apache HTTP Server

  4. #4

    Default Re: Localhost URL without username

    Thanks you both, I didn't know that there is any other "web container".

    Regards Draffix

  5. #5

    Default Re: Localhost URL without username

    Quote Originally Posted by Draffix View Post
    Thanks you both, I didn't know that there is any other "web container".
    What do you mean with that, /srv/www/httdocs?
    Yes, that's the central location for web pages in the default configuration.

    And every user can set up his/her own webpage in his/her $HOME/public_html as you already knew.

    The central location (/srv/www/httdocs) can be changed in apache's config with the DocumentRoot directive as I mentioned before. And it can be set differently for each virtual host, that's why it's recommended to set up a virtual host if you want to change it and leave the default configuration files alone.
    The link I posted should explain how to do this, but in short virtual hosts are defined in files in /etc/httpd/vhosts.d/ which are included automatically by the default configuration, so you don't need to change those files that got shipped in the RPMs.

  6. #6

    Default Re: Localhost URL without username

    Yes I thought /srv/www/httdocs/ and the only one who use this PC is me so I don't need set up anything. It's only for my purpose, develop and testing, nothing more. I think that use the file as I mentioned before is the simpliest solution for me.

  7. #7

    Default Re: Localhost URL without username

    Quote Originally Posted by Draffix View Post
    Yes I thought /srv/www/httdocs/ and the only one who use this PC is me so I don't need set up anything. It's only for my purpose, develop and testing, nothing more. I think that use the file as I mentioned before is the simpliest solution for me.
    OK. I thought you want to have it in your home directory because of the permissions...(in /srv/www/httdocs you normally only can change things as root)
    In that case you could of course also just change the permissions of /srv/www/httpdocs/ to rwxrwxrwx so you can edit everything in there.

  8. #8
    Join Date
    Jan 2013
    Location
    Germany
    Posts
    289

    Default Re: Localhost URL without username

    Quote Originally Posted by wolfi323 View Post
    In that case you could of course also just change the permissions of /srv/www/httpdocs/ to rwxrwxrwx so you can edit everything in there.
    Why do you want to change all the rights for /srv/www/htdocs? Everybody can write and execute all fhe files there, if you would have changed to rwxrwxrwx. That isn't the sense of chmod.

  9. #9

    Default Re: Localhost URL without username

    Quote Originally Posted by AdaLovelace View Post
    Why do you want to change all the rights for /srv/www/htdocs?
    Because of this:
    Quote Originally Posted by Draffix View Post
    and the only one who use this PC is me so I don't need set up anything. It's only for my purpose, develop and testing, nothing more.
    Changing the permissions is the easiest way to achieve this, IMHO.

    And you're wrong with:
    Everybody can write and execute all fhe files there, if you would have changed to rwxrwxrwx.
    'x' on a directory doesn't mean you can execute files in there, it just means that you can enter the directory and list it.
    (And html and php files are not executable on their own anyway, but that's a different story... )

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •