Showing posts with label apache. Show all posts
Showing posts with label apache. Show all posts

10 May, 2018

Apache: how to use a local folder for your code on localhost


  1. Create a folder for your html
    # mkdir ~/html_root
  2. Create a symbolic link in /srv/html/
    # sudo ln -s /home/USER/html_root/ X
  3. Write your code, and test it in a browser, as in:
    # http://localhost/X/

30 September, 2015

WordPress on the lan - how to use the correct url

Phpmyadmin > wordpress > wp_options


Problem: localhost in stead of ip
In links and stylesheets WordPress used something like:

http://localhost/whatever ...

It should be something like:

http://192.168.0.22/whatever ...

Solution: 
Open the wp_options table, and rename the http address to the correct ip, e.g.

siteurl: http://192.168.0.12/wordpress
home: http://192.168.0.12/wordpress

27 September, 2015

Get read and write permissiongs to shared WordPress (or other) folders

It's so nice to be able to edit your themes in the File Manager


This works like a magick spell:
# sudo groupadd tomandruser

Now that the group exists, add the two users to it:

# sudo usermod -a -G tomandruser tomcat6
# sudo usermod -a -G tomandruser ruser

Now all that's left is to set the permissions on the directory:

# sudo chgrp -R tomandruser /path/to/the/directory
# sudo chmod -R 770 /path/to/the/directory

( See Andrew Lambert's proposal no. 71 in this thread )

On my localhost I decided to share the WordPress themes folder in this way. Here's what I did on my Debian-based system:

  1. Created the goup called webeditor
  2. Added my user to the group.
Added www-data to the same group.
  1. Changed the themes/ folder to the webeditor group.
  2. Changed the permissions of the themes folder to 777.

Now I only need to create a folder and ln -s to the themes folder. Then it's possible to edit themes at log in via the symbolic link:

# ln -s /var/lib/wordpress/wp-content/themes/ ~/wpthemes

But when WordPress or the user create their own stuff, it looks like this:

$ ls -l
totalt 16
drwxr-xr-x 6 www-data www-data  4096 sep 27 09:23 dusk-to-dawn
drwxrws--- 7 www-data webeditor 4096 sep 27 09:33 twentyfifteen
drwxrwx--- 9 www-data webeditor 4096 sep 26 19:30 twentyfourteen
drwxr-xr-x 2 per      per       4096 sep 27 09:52 x


So you can edit the files, but have to change the permissons to folders installed by WordPress.
 

26 March, 2015

xampp cannot use wordpress theme images

A localhost WordPress could not display images from the themes folder in Xampp on a Linux Mint system.

Solution: all folders must be owned by the Apache user and group (daemon:daemon), or:

# chown -R daemon:daemon [theWordPressThemenameFolder/]
# chmod -R 777 [theWordPressThemenameFolder/]

However this is only for development purposes. On a server work by these guidelines.

27 July, 2011

Hurtig opsætning af en billed og musik server

Symbolske links er en herlig ting. På apacheserveren i det lille hjem har jeg oprettet et symbolsk link til billed- og musikmapperne i /var/www - fx. /var/www/fotos. Og så er der ellers adgang til musik og billeder fra eksterne dimere, som iPads, netbook etc.