※内容が古いので参考程度にお読み下さい!!! | |
Macintosh(Mac) 用のフリーのHTTPサーバーを使ってWebサーバーを立ち上げてみます。 | |
◆ | ダウンロード |
http://www.machttp.org にアクセスします。下図のようなページが表示されます。 | |
|
|
画面左側の “Main Menu” の中にある “Download MacHTTP” をクリックします。 下図のようなページが表示されます。 |
|
|
|
ページをスクロールして “Current Release” の中にある “download from MacHTTP.org - SourceForge(primary site,HTTP,US” の “HTTP” 部分をクリックします。 | |
|
|
下図のようにダウンロードが開始されます。 | |
|
|
お使いの環境によってはダウンロードが開始されず下図のようなページが表示される場合があります。この場合はお好きなミラーサイトの “Download” をクリックするとダウンロードができます。ちなみに国内では北陸先端科学技術大学院大学があります。 | |
|
|
下図のような圧縮ファイルがダウンロードされます。 | |
|
|
◆ | 解凍 |
ダウンロードされた圧縮ファイルをダブルクリックします。 下図のように解凍ソフトが立ち上がります。お使いの環境によっては違う解凍ソフトが立ち上がったり、解凍できない場合もあります。 |
|
|
|
解凍する場所を指定して『保存』ボタンをクリックします。 | |
|
|
解凍が始まります。 | |
|
|
解凍が終了しましたので『Quit』ボタンをクリックします。 | |
|
|
下図のように解凍されたファイルができます。 | |
|
|
下図は解凍されたファイルの内容です。 | |
|
|
サブディレクトリ “MacHTTP Software and Docs” の内容です。 | |
|
|
◆ | MacHTTPの設定 |
MacHTTP
の場合は解凍してできたフォルダをそのまま使うのが一般的ですがせっかくWeb専用フォルダを www (任意の名前)を作ったのですからそれを利用します。 解凍したファイルのサブディレクトリ “MacHTTP Software and Docs” の中身全てを www の中にコピーします。 後は下記の設定をして下さい。 |
|
解凍したファイルのサブディレクトリ “MacHTTP Software and
Docs” の中に “MacHTTP.config” と言うファイルがあります。これが設定ファイルです。 この “MacHTTP.config” を SimpleText 等のエディタで開きます。下記が “MacHTTP.config” の全文です。緑文字の所を青文字に書き換えてください。(赤字は補足です) ------------------------------------------------------------------------------------------- #MacHTTP Configuration file, v. 2.6##The format of this file is free form, with a few exceptions. Lines not#starting with a recognized keyword are ignored. #Note, all entries are converted to upper case by MacHTTP, so the config file isn't #case sensitive, with the exception of Mac file types and creators below. #Note that any text styles like bold or underline in this file are purely cosmetic # and are only intended to make the file easier to read. The styles are not required. #Legal config file keywords will appear as BOLD text if this file is viewed with # SimpleText or TeachText. # The version number below should match MacHTTP's version number VERSION 2.6 ###################################################### # "Special" Files # #The following line defines the default file type if a suffix match isn't found. #The syntax is: DEFAULT <default transfer type> <default MIME type> DEFAULT TEXT text/html #The following lines specify where to find HTML files for error messages, the #default home (or index) page, the name of the log file, and the message #returned for security violations. Any of these three file directives point to a #HTML document, script, or CGI application. # #NOTE!!! INDEX must be a simple file name, not a path like the other files. INDEX Default.html ERROR :Error.html NOACCESS :NoAccess.html #If the LOG file directive is missing or commented out, no logging will occur. LOG :MacHTTP.log #################################################### # The following commands can be used to adjust MacHTTP's behavior and # performance. Most of them can be adjusted via AppleScript and AppleEvents # as well. #A single copy of MacHTTP only listens on a single port for multiple #connections. The HTTP standard port is 80. Users may define any port #they'd like to listen on, but internet standards say that ports #numbered 1024 and below are reserved for "Well known services" that #are pre-defined. That means if you change MacHTTP's port from 80, #you should pick a number greater than 1024 to avoid conflicting with #things like telnet, gopher, ftp, nfs, pop, etc. that all have ports #assigned below 1024. PORT 80 ポート番号の指定(通常はこのまま) #Sets the timeout for inactive connections to 60 seconds TIMEOUT 60 #Comment out this line to disable Thread Manager use. Uncommenting # this line has no effect if the Thread Manager isn't installed as part of # the server's operating system. (i.e., pre-System 7.5 #USE_THREADS #Sets the max number of simultaneous users to 12. #The minimum value is 3, the maximum is 48 #For larger values, you should monitor memory usage and increase #MacHTTP's memory allocation in the Finder accordingly. #If USE_THREADS is enabled, the server will use approximately 48k of #memory per user. When using the threaded version, this setting #controls how many threads are started. MAXUSERS 12 #Sets the number of "listens" MacHTTP performs simultaneously. For #busy servers with clients that report "Unable to connect" errors, #this number should be increased. If the "Listening" statistic in #the status window ever drops to 1, some clients may miss connecting. #Default is 6, minimum is 3, maximum is 48. Never set the number of # listens to be more than the MAXUSERS! # If USE_THREADS is enabled, this value is ignored and MAXUSERS is # used to determine how many threads (listening) are active. MAXLISTENS 6 # This is the number of ticks that MacHTTP will "steal" from other processes while # sending data to clients. This equates directly to how much time MacHTTP will spend # processing connections. Your Mac will effectively be dedicated to MacHTTP for this # period of time. The argument is in "ticks", which are 60ths of a second. The default # is .5 seconds. (30 ticks) Values can range between 0 and 120. Selecting 0 tells # MacHTTP to use its internal default value. PIG_DELAY 0 # This value specifies what argument to pass to WaitNextEvent while MacHTTP # is the foreground application. It adjusts how friendly MacHTTP is to background apps. # The default value is 1. Valus can range from 0 to 120 ticks, with larger numbers being # "friendlier". Numbers above 20 will generally have an adverse impact on MacHTTP's # performance. FOREGROUNDTICKS 5 # This value specifies what argument to pass to WaitNextEvent while MacHTTP # is the background application. It adjusts how friendly MacHTTP is to all other apps. # The default value is 5. Valus can range from 0 to 120 ticks, with larger numbers being # "friendlier". Numbers above 20 will generally have an adverse impact on MacHTTP's # performance. BACKGROUNDTICKS 5 # This is the chunk size that MacHTTP will divide file transfers into. The larger the # chunk, the longer it will take to transmit over slow connections. The smaller it is, the # more times MacHTTP will be able to swap between servicing multiple connections and # freeing the Mac to work on other processes. The argument represents the max number of # bytes to be sent in a single MacTCP write to the client. The min is 256, the max is 10240. DUMP_BUF_SIZE 8192 # MacHTTP can be configured to eliminate DNS accesses. For best performance, # uncomment the following line. MacHTTP will log IP addresses rather than # host names, but the software will perform much faster when used with # slow domain name servers. #NO_DNS # It is also possible to exclude specific IP addresses from # DNS searches. You might want to do this with local-area addresses # behind a firewall or Internet Connection Sharing device. Excluding specific # addresses has no effect if NO_DNS is specified. End complete host # IP addresses with a "." for an exact match. Otherwise a # statement like "DNS_EXLCUDE 129.106.3" would exclude hosts 129.106.30.*, # 129.106.31.*, 129.106.32.*, etc. # To exclude all local addresses on most home and business networks, use #DNS_EXCLUDE 192.168.0. #DNS_EXCLUDE 10. # This defines the interval before MacHTTP archives the current log file and # begins a new one. The value is the number of days between archives. Setting # this value to zero disables log file rollovers. The default is 0. LOG_ROLLOVER 0 ##################################################### # ACTIONS # Actions are a way to have multiple files processed by a single ACGI or # plug-in, based on suffix, type, or creator. For example, Actions would let # you route all requests for files with a suffix of ".XYZ" through an ACGI # to perform some manipulation of the data before returning it to the client. # # Action definitions MUST precede any SUFFIX definition that uses the action. # # The following two lines define the example above. Note that the "SUFFIX" # command is identical to a normal suffix mapping command except that # it is preceded by the keyword "SUFFIX" and the action can be user defined # instead of the usual predefined actions (TEXT, BINARY, etc.) #ACTION XYZTEST :newtest.acgi #SUFFIX XYZTEST .XYZ APPL * text/html # Any URL sent to MacHTTP that ends with .XYZ will invoke the XYZTEST action, # causing the ACGI named newtest.acgi to run. #uncomment this suffix mapping to enable the internal plugin action. Any URL #ending in .pitest will then trigger the action. #SUFFIX PI_SAMPLE .PITEST * * text/html ##################################################### # SUFFIXES #These lines define the suffix and file type mappings for MIME types. #The syntax is <type> <suffix> <mac file type> <mac creator> <mime type> # #Unspecified parameters should be replaced with "*". MacHTTP tries to match #a file suffix first. Failing that, it tries to match Mac file type info, and if it #can, Mac creator info as well. Matching either suffix or type/creator determines #the transfer type and MIME type. If the client supports HTTP/1.0, the appropriate #MIME header will be constructed and returned, based on the info below. #Scripts are responsible for generating their own HTTP/1.0 headers!!! # # High priority items should be near the top # SUFFIX TEXT .HTML TEXT * text/html SUFFIX TEXT .HTM TEXT * text/html SUFFIX BINARY .GIF GIFf * image/gif SUFFIX BINARY .JPEG JPEG * image/jpeg SUFFIX BINARY .JPG JPEG * image/jpeg SUFFIX ACGI .ACGI APPL * text/html SUFFIX RAW .RAW RAW! * text/html # # Everything else below here # SUFFIX BINARY .AIFF * * audio/x-aiff SUFFIX TEXT .ASP TEXT * text/html SUFFIX BINARY .AU * * audio/basic SUFFIX BINARY .AVI DivX * video/avi SUFFIX BINARY .BMP * * image/x-xbm SUFFIX CGI .CGI APPL * text/html SUFFIX BINARY .CLASS clss java application/x-java-vm SUFFIX TEXT .CSS TEXT * text/css SUFFIX BINARY .DOC WDBN MSWD application/msword SUFFIX TEXT .HQX TEXT * application/mac-binhex40 SUFFIX BINARY .ICO .ico * image/x-icon SUFFIX BINARY .JAR ZIP%20 java application/x-java-archive SUFFIX TEXT .JS TEXT * text/javascript SUFFIX BINARY .MOV MOOV * video/quicktime SUFFIX BINARY .MP3 Mp3%20 * audio/mpeg SUFFIX BINARY .MP3 MPG3 * audio/mpeg SUFFIX BINARY .MP3 PLAY * audio/mpeg SUFFIX BINARY .MPEG MPEG * video/mpeg SUFFIX BINARY .MPG MPEG * video/mpeg SUFFIX BINARY .PDF PDF%20 * application/pdf SUFFIX BINARY .PICT PICT * image/pict SUFFIX BINARY .PNG PNG%20 * image/png SUFFIX BINARY .PNG PNGf * image/png SUFFIX BINARY .POT PPOT * application/vnd.ms-powerpoint SUFFIX BINARY .PPT SLD3 * application/vnd.ms-powerpoint SUFFIX BINARY .PPT SLD8 * application/vnd.ms-powerpoint SUFFIX BINARY .QT MooV * video/quicktime SUFFIX BINARY .RTF RTF%20 * application/rtf SUFFIX BINARY .SIT SIT! * application/x-stuffit SUFFIX BINARY .SIT SIT5 * application/x-stuffit SUFFIX BINARY .SIT SITD * application/x-stuffit SUFFIX BINARY .SIT SITD * application/x-stuffit SUFFIX BINARY .SWF SWFL TVOD application/x-shockwave-flash SUFFIX TEXT .TEXT TEXT * text/plain SUFFIX BINARY .TIF TIFF * image/tiff SUFFIX BINARY .TIFF TIFF * image/tiff SUFFIX TEXT .TXT TEXT * text/plain SUFFIX BINARY .WAV WAVE * audio/x-wave SUFFIX BINARY .WMV ASF_ Ms01 video/x-ms-wmv SUFFIX BINARY .WORD W8BN MSWD application/msword SUFFIX BINARY .XBM * * image/x-xbm SUFFIX BINARY .XL XLS8 * application/excel SUFFIX BINARY .XLS XLS3 * application/excel SUFFIX TEXT .XML TEXT * text/xml SUFFIX BINARY .ZIP ZIP%20 * application/zip # # These suffix mappings are deprecated and should only be # enabled if you know you require them. # #SUFFIX SCRIPT * TEXT ToyS text/html #SUFFIX APPL .EXE APPL * text/html #SUFFIX SCRIPT .SCRIPT TEXT * text/html
##################################################### # Security configuration # # Security realms - see the Security tutorial for more details #REALM workers Co-Workers #REALM cust Customers #IP and domain name security. There is an implied "DENY *" that is evaluated #prior to any address security specifications if they are present. If no ALLOW/DENY #statements are present in the config file, the default is an implied "ALLOW *". # #End complete host IP addresses with a "." for an exact match. #Otherwise a statement like "ALLOW 129.106.3" would match hosts 129.106.30.*, #129.106.31.*, 129.106.32.*, etc. # #You may also specify domain names for ALLOW and DENY statements. #The domain names are matched from right to left, as opposed to the #left to right matches done for IP address ALLOW and DENY statements. Also, the #domain names you specify are case-sensitive and MUST end with a period (.). #For example: # ALLOW abc.edu. # DENY mac22.abc.edu. #would deny all hosts (implicit DENY *), allow any abc.edu node, and deny the #specific host, mac22.abc.edu. #NOTE!!! "ALLOW *" and "DENY *" are not valid syntax! #To deny a single address and allow all others, you must specify a sequence of # ALLOW statements for all possible numbers (e.g., ALLOW 1*, ALLOW 2*, etc.), # followed by the address(es) to DENY. #ALLOW 123.45.6. #DENY 123.45.6.7. ##################################################### # Multiple Domain Name Support # # MacHTTP allows you to host multiple domain names on your single IP address # by routing each domain name to a different folder. (These folders must # be inside your base MacHTTP folder.) You can also specify different folders for different # variants of each domain name. You could, for example, route www.mydomain.net # to one folder and ftp.mydomain.net to another. To catch any variant # not otherwise specified, use "*." as in *.mydomain.net. #The following is a minimum configuration that routes any variant of mydomain.net # to a folder called MyDomainFolder in your MacHTTP folder. #HOSTFOLDER mydomain.net MyDomainFolder #HOSTFOLDER *.mydomain.net MyDomainFolder # The following is a more complex configuration that routes some variants # to different locations #HOSTFOLDER mycompany.com MyCompany/Home #HOSTFOLDER *.mycompany.com MyCompany/Home #HOSTFOLDER members.mycompany.com MyCompany/Members #HOSTFOLDER downloads.mycompany.com MyCompany/Downloads #You can combine any number of domain names, and each domain name can have #as many variants as you like. MacHTTP searches the entire list for an exact #match before searching for a wildcard match. #You can specify a "catchall" folder that catches any request not otherwise routed #with either an exact match or a wildcard match: #HOSTFOLDER * CatchallFolder ------------------------------------------------------------------------------------------- 設定と言ってもほとんどありません。デフォルトのままで十分使えます。 |
|
◆ | 起動 |
起動
と言っても特別することはありません。 コピーしたファイルの中の “MacHTTP 2.6” をダブルクリックするだけです。 |
|
|
|
下図ようにステータスウィンドウが表示されサーバーが起動されます。 | |
|
|
後は index.html と言うファイルを作り MacHTTP と同じフォルダに保存します。 ネットワークに繋がった他のパソコンのインターネットブラウザでサーバー機のアドレスを入力して下図のようにそのファイルが表示されればテストOKです。 |
|
|
|
また、上記設定で INDEX Default.html を書き換えなかった場合は下図のようなページが開きます。 | |
|
|
なお、上記設定で INDEX Default.html の設定(書き換え)を間違えると下図のような一覧が表示されます。 | |
|
|