在虚拟机上用nginx怎么搭建lnmp

微信小程序,微信公开课,在虚拟机上用nginx怎么搭建lnmp 微信公开课

微信公开课小程序热门讨论「在虚拟机上用nginx怎么搭建lnmp」最新回复-一、参考这里以配置2个站点(2个域名)为例,n个站点可以相应增加调整,假设:IP地址:202.55.1.100域名1example1.com放在/www/example1域名2example2.com放在/www/example2配置nginxvirtualhosting的基本思路和步骤如下:把2个站点example1.com,example2.com放到nginx可以访问的目录/www/给每个站点分别创建一个nginx配置文件example1.com.conf,example2.com.conf,并把配置文件放到/etc/nginx/vhosts/然后在/etc/nginx.conf里面加一句include把步骤2创建的配置文件全部包含进来(用*号)重启nginx具体过程下面是具体的配置过程:1、在/etc/nginx下创建vhosts目录mkdir/etc/nginx/vhosts2、在/etc/nginx/vhosts/里创建一个名字为example1.com.conf的文件,把以下内容拷进去server{listen80;server_nameexample1.comwww.example1.com;access_log/www/access_example1.logmain;location/{root/www/example1.com;indexindex.phpindex.htmlindex.htm;}error_page500502503504/50x.html;location=/50x.html{root/usr/share/nginx/html;}#passthePHPscriptstoFastCGIserverlisteningon127.0.0.1:9000location~\.php${fastcgi_pass127.0.0.1:9000;fastcgi_indexindex.php;fastcgi_paramSCRIPT_FILENAME/www/example1.com/$fastcgi_script_name;includefastcgi_params;}location~/\.ht{denyall;}}3、在/etc/nginx/vhosts/里创建一个名字为example2.com.conf的文件,把以下内容拷进去server{listen80;server_nameexample2.comwww.example2.com;access_log/www/access_example1.logmain;location/{root/www/example2.com;indexindex.phpindex.htmlindex.htm;}error_page500502503504/50x.html;location=/50x.html{root/usr/share/nginx/html;}#passthePHPscriptstoFastCGIserverlisteningon127.0.0.1:9000location~\.php${fastcgi_pass127.0.0.1:9000;fastcgi_indexindex.php;fastcgi_paramSCRIPT_FILENAME/www/example2.com/$fastcgi_script_name;includefastcgi_params;}location~/\.ht{denyall;}}4、打开/etc/nginix.conf文件,在相应位置加入include把以上2个文件包含进来usernginx;worker_processes1;#mainservererrorlogerror_log/var/log/nginx/error.log;pid/var/run/nginx.pid;events{worker_connections1024;}#mainserverconfighttp{includemime.types;default_typeapplication/octetstream;log_formatmain‘$remote_addr–$remote_user[$time_local]$request‘‘”$status”$body_bytes_sent“$http_referer”‘‘”$http_user_agent”“$http_x_forwarded_for”‘;sendfileon;#tcp_nopushon;#keepalive_timeout0;keepalive_timeout65;gzipon;server{listen80;server_name_;access_log/var/log/nginx/access.logmain;server_name_in_redirectoff;location/{root/usr/share/nginx/html;indexindex.html;}}#包含所有的虚拟主机的配置文件include/usr/local/etc/nginx/vhosts/*;}5、重启Nginx/etc/init.d/nginxrestart/参考二、我的实例vhosts/led.confserver{listen80;server_namewww.led.comindexindex.htmlindex.htmindex.php;root/usr/local/vhost/led;#charsetkoi8r;#access_loglogs/host.access.logmain;location/{root/usr/local/vhost/led;indexindex.htmlindex.htmindex.php;}#error_page404/404.html;#redirectservererrorpagestothestaticpage/50x.html#error_page500502503504/50x.html;location=/50x.html{roothtml;}#proxythePHPscriptstoApachelisteningon127.0.0.1:80##location~\.php${#proxy_passhttp://127.0.0.1;#}location~.*\.(php|php5)?${#fastcgi_passunix:/tmp/phpcgi.sock;fastcgi_pass127.0.0.1:9000;fastcgi_indexindex.php;fastcgi_paramSCRIPT_FILENAME/scripts$fastcgi_script_name;includefastcgi_params;}location~.*\.(gif|jpg|jpeg|png|bmp|swf)${expires30d;}location~.*\.(js|css)?${expires1h;}log_formataccess$remote_addr$remote_user[$time_local]$request$status$body_bytes_sent$http_referer$http_user_agent$http_x_forwarded_for;}nginx.confusernginxnginx;worker_processes8;error_loglogs/error.log;#error_loglogs/error.lognotice;#error_loglogs/error.loginfo;pid/usr/local/nginx/nginx.pid;worker_rlimit_nofile65535;events{useepoll;worker_connections65535;}http{includemime.types;default_typeapplication/octetstream;#log_formatmain$remote_addr$remote_user[$time_local]$request#$status$body_bytes_sent$http_referer#$http_user_agent$http_x_forwarded_for;#access_loglogs/access.logmain;server_names_hash_bucket_size128;client_header_buffer_size32k;large_client_header_buffers432k;client_max_body_size8m;sendfileon;tcp_nopushon;#keepalive_timeout0;keepalive_timeout65;tcp_nodelayon;fastcgi_connect_timeout300;fastcgi_send_timeout300;fastcgi_read_timeout300;fastcgi_buffer_size64k;fastcgi_buffers464k;fastcgi_busy_buffers_size128k;fastcgi_temp_file_write_size128k;gzipon;gzip_min_length1k;gzip_buffers416k;gzip_http_version1.0;gzip_comp_level2;gzip_typestext/plainapplication/xjavascripttext/cssapplication/xml;gzip_varyon;server{listen80;server_name_;server_name_in_redirectoff;location/{root/usr/share/nginx/html;indexindex.html;}}#包含所有的虚拟主机的配置文件include/usr/local/nginx/conf/vhosts/*;}
可以下载一个epel的yum源 +通过命令yuminstall-ynginxmysqlmysql-serverphp可以通过源码部署 更多有关「在虚拟机上用nginx怎么搭建lnmp」的疑问请扫码关注微信公开课+小程序!了解更多

「在虚拟机上用nginx怎么搭建lnmp」热议话题订阅

微信小程序,微信公开课,在虚拟机上用nginx怎么搭建lnmp
订阅小程序

方法1:微信扫描微信公开课小程序码即可订阅热议话题「在虚拟机上用nginx怎么搭建lnmp」

方法2:微信搜索微信公开课小程序名称进入,即可订阅热议话题「在虚拟机上用nginx怎么搭建lnmp」

方法3:微信网页访问即速商店,长按识别微信公开课小程序码即可订阅热议话题「在虚拟机上用nginx怎么搭建lnmp」

微信公开课小程序热议话题「在虚拟机上用nginx怎么搭建lnmp」由微信公开课原创摘录于微信小程序商店shop.jisuapp.cn,转载请注明出处。

微信公开课热议话题「在虚拟机上用nginx怎么搭建lnmp」由微信公开课开发者向微信用户提供,并对本服务内容、数据资料及其运营行为等真实性、合法性及有效性承担全部责任。