openresty入門-web服務器搭建


傻瓜式的跟着教程一步步安裝:

准備條件:

1:linux 操作系統。

2:make,gcc,gdb等一堆工具的安裝

3:openresty依賴的安裝。apt-get install libreadline-dev libpcre3-dev libssl-dev perl

4:wget https://openresty.org/download/openresty-1.15.8.3.tar.gz下載源碼

5:解壓。tar -zxvf openresty-1.15.8.3.tar.gz

6:進入解壓目錄。執行./configure

7:make && make install

8:創建web服務器的文件路徑。mkdir /home/www

9:進入到/home/www目錄。創建logs和conf文件夾。mkdir logs/ conf/

10:在conf文件夾下創建nginx.conf文件

11:編輯配置文件保存。

worker_processes 1;
error_log logs/error.log;
events {
	worker_connections 1024;
}
http {
	server {
		listen 9000;
		location / {
			default_type text/html;
			content_by_lua '
			ngx.say("<p>hello, web! </p>");
			';
		}
	}
}

12:啟動web服務器:/usr/local/openresty/nginx/sbin/nginx  -p `pwd`/ -c conf//nginx.conf

13:校驗安裝是否成功。curl http://localhost:9000 或者輸入ip地址:端口


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM