Recent Posts

[Tips]How to use Image for Normal map in Blender

GOAL

To create normal map from RGB image.

Environment

Windows10
Blender 2.8a

Method

Create new Principled BSDF material.

Set “NormalMap” to the parameter “Normal”. And set “Image Texture” to the parameter “Calor”.

Open and select normal map to apply.

Open UV editor and adjust the UV Mapping.

You can use Nodes to change the scale of input image.

How to Build Local Server 2 -Change Root Directory-

GOAL

To change settings of Apache and use your local directory as root directory.

Before changing settings of Apache, install and setup Apache. Refer to “How to Build Local Server 1” for more about installation procedure.

Environment

Windows 10
Apache 2.4.43

Change local server root

1. Set DocumentRoot in httpd.conf.

I created new directory “root” in Apache24 and set it as DocumentRoot.

# DocumentRoot: The directory out of which you will serve your
# documents. By default, all requests are taken from this directory, but
# symbolic links and aliases may be used to point to other locations.
#
#DocumentRoot "${SRVROOT}/htdocs"
DocumentRoot "${SRVROOT}/root"

2. Confirm the result

Change Directives

Open httpd.conf. and change <Directory> Directive.

<Directory "${SRVROOT}/loot">
	Options Indexes FollowSymLinks
	AllowOverride None
	Require all granted
</Directory>

<Directory> Directive can control  group of directives.

Directives detail

Options: The Options directive controls which server features are available.
Indexes: If a URL which maps to a directory is requested and there is no DirectoryIndex (e.g., index.html) in that directory, then mod_autoindex will return a formatted listing of the directory.
FollowSymLinks: The server will follow symbolic links in this directory. This is the default setting.
You can see more of Options directive in Options Directive.

AllowOverride: When this directive is set to None, .htaccess files are completely ignored. .htaccess file is the configurations file for non-administrator users.
You can see more of Options directive in AllowOverride Directive.

Require: This directive tests whether an authenticated user is authorized according to a particular authorization provider and the specified restrictions.
all granted: Grant access to all requests.
You can see more of Options directive in Require Directives.

Confirm results

Put index,html and resources into root directory. Access localhost with any browser you like.

How to Build Local Server 1 -Install and Setup Apache-

GOAL

To setup Apache and build local web server with it. In this article, you can only display default page. If you would like to create new directory as a local serer, check “How to Build Local Server 2” after Apache setup.

Environment

Windows 10
Apache 2.4.43

What is Apache?

Apache is open source application for implementation of an HTTP (Web) server. You can build local web server and global web server regardless of whether it is commercial use or not.

Why is the local web server necessary? 

Local web server is used as a virtual environment for development and test before publishing to the live server. You can make local file a test server that only local users can access.

Installation and setup of Apache

Installation

1. Open Download page “Apache HTTP Server project website“.

2. Click Files for Microsoft Windows if you use windows.
* Click “Binaries” if you don’t use windows.
* I don’t know why but I couldn’t click “Source: httpd-2.4.43.tar.bz2”.

3. Select one sit from the list. In my case, I clicked “Apache Lounge”.

4. Install Apache 2.4.43 Win64 or Apache 2.4.43 Win32

Setup

1. Unzip httpd-2.4.43-win64-VS16.zip and open it. You can see the directory named “Apache**”.

2. Put the directory “Apache24” into the directory you want. I put it on document directory.

3. Open Apache24>conf>httpd.conf with your favorite text editor.

Change definition of SRVROOT into the path to “Apache24”

#default
#Define SRVROOT "c:/Apache24"
Define SRVROOT "C:\Users\USER_NAME\Documents\Apache24\conf"

ServerRoot "${SRVROOT}"

Change ServerName

# If your host doesn't have a registered DNS name, enter its IP address here.
#
#ServerName www.example.com:80
ServerName localhost:80

Start Apache

Use command as below or just double-click httpd.exe.

Open command prompt and change directory into the Apache24¥bin

> cd C:\Users\USER_NAME\Documents\Apache24\bin
> httpd
AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using ******. Set the 'ServerName' directive globally to suppress this message

If you got an warning about fire wall, allow the access in private network.

Access localhost

How to run httpd in the background?

You should register httpd as a windows service. Open command prompt as administrator and install httpd.

> cd C:\Users\USER_NAME\Documents\Apache24\bin
>  httpd -k install
Installing the 'Apache2.4' service
The 'Apache2.4' service is successfully installed.
Testing httpd.conf....

Then you can start httpd by command as below.

httpd -k start

You can stop/shutdown by commands as below. It works only when command prompt is run by an user as administrator.

> httpd -k stop
> httpd -k shutdown

Change contents

Put index.html and resources into Apache24\htdocs. I put index.html below.

<!doctype html>
<html lang="en">
<head>
  <meta charset="utf-8">

  <title>My page</title>
  <meta name="description" content="The HTML5 Herald">
  <!--[if lt IE 9]>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/html5shiv/3.7.3/html5shiv.js"></script>
  <![endif]-->
</head>

<body>
  <h1>My Page</h1>
  <p>this is test page!</p>
</body>
</html>

Next Step

Change root directory from Apache24\htdocs into your local directory. Check How to Build Local Server 2 -Change Root Directory- for details.

Categories

AfterEffects Algorithm Artificial Intelligence Blender C++ Computer Graphics Computer Science Daily Life DataAnalytics Event Game ImageProcessing JavaScript Kotlin mathematics Maya PHP Python SoftwareEngineering Tips Today's paper Tools TroubleShooting Unity Visual Sudio Web Windows WordPress 未分類