对于我正在设置的基于Linux的Apache 2.2服务器,我有一个相当简单的问题.我想在同一台服务器上设置两个完全不同的域.但它只提供第一个标签的内容!我搜索过StackOverflow并在Apache.org上阅读项目但没有运气.
我按照Apache.org上的说明进行操作,并将这两部分放在我的http.conf文件的底部.
<VirtualHost *:80>
DocumentRoot /var/www/mydomain1
ServerName sub1.mydomain1.com
</VirtualHost>
<VirtualHost *:80>
DocumentRoot /var/www/mydomain2
ServerName sub2.mydomain2.com
</VirtualHost>
Run Code Online (Sandbox Code Playgroud)
现在,当我使用浏览器访问:http://sub1.mydomain1.com它很好.但是如果我去http://sub2.mydomain2.com我仍然只能获得位于/ var/www/webfiles/mydomain1中的内容.
我做了许多显而易见的事情,例如: - service httpd restart - 我改变了httpd.conf中两个条目的顺序,再一次,它只服务于列表中的第一个条目. - 我使用Googled的一个支持文档说,确保在您的系统上有一个有效域的以下入口点.所以我输入了这个(但它没有改变任何东西):ServerName sub2.mydomain2.com:80
它一定是愚蠢的东西,但我无法弄清楚!
我有一个简单的问题,我似乎无法弄明白.在下面的代码中,我得到一个错误(test_str未定义),因为定义"var str ="的行分布在两行中.在"狐狸"这个词之后有一个CR LF,我想我的浏览器中的javascript引擎认为我想要一个新的声明.现在当然在这个例子中我可以简单地摆脱回车并把它全部放在一行来修复它.但我的真正意图是在一些生产代码中使用更长的字符串,我真的不想删除所有那些CR LF.
<html>
<head>
<script>
function test_str() {
str = " The quick brown
fox jumped over the log.";
alert(str);
}
</script>
</head>
<body>
<a href='javascript:void(0);' onclick='test_str();'>Test String</a>
</body>
</html>
Run Code Online (Sandbox Code Playgroud) 我在我的Ubuntu服务器上安装了一个开源PHP项目并让它运行.但是,页面加载速度极慢.phpinfo()页面和连接到mysql db的基本测试页面加载速度非常快.这个开源代码中有大量的包含文件,日志文件和一些curl调用.我可以使用哪些策略/工具来追踪缓慢的来源?
我无法弄清楚为什么我的段落中的字母(如g和y)下方的字母会被切断.我尝试将线高设置得更高,但它仍然将它们切断.我在px,pt和em中玩过font-size,但仍然没有运气.现在,当我将字体大小设置得更大(如3.0em)时,问题就消失了.但我需要字体大小这个大小.
这是链接:http://sportegy.com/font-test/font-test.html
您需要使用该链接并查看我拥有的.ttf字体才能真正看到问题.但是,我也会在这里粘贴我的HTML.
<html>
<head>
<style>
@font-face {
font-family: lib-font;
src: url('css/LiberationSansNarrow-Regular.ttf');
}
@font-face {
font-family: lib-bold;
src: url('css/LiberationSansNarrow-Bold.ttf');
}
</style>
</head>
<body>
<span style='font-family: lib-font;color: #232322;font-size: 1.0em;'>
The quick brown foxy was jumping over the green doggy.<br/>
The quick brown foxy was jumping over the green doggy.<br/>
The quick brown foxy was jumping over the green doggy.<br/>
The quick brown foxy was jumping over the green doggy.<br/>
The quick brown foxy was jumping over the green …Run Code Online (Sandbox Code Playgroud) 我是nodejs的新手,我正在编写一些代码,需要查询我的MySQL数据库并从给定的user_id返回一个用户名.我一直在读你所有的功能应该是异步的.在这种情况下,理想情况下我希望服务器能够在进行此查询时响应其他事件请求.但是,它不是一个特别大的查询,只返回一个值.也许我应该让它同步?(如果这是你的答案,改变它的示例代码会很棒)无论如何,这是我的功能.它在最后一行"return current_username;"附近发出错误 因为当前current_username未定义.有什么建议?
function get_current_username(current_user_id) {
console.log(' | Entered get_current_username');
sqlq = 'SELECT username FROM users WHERE id = ' + current_user_id;
connection.query(sqlq, function(err, rows, fields) {
if (err) throw err;
var current_username = rows[0].username;
console.log(' | the current_username =' + current_username);
});
return current_username;
Run Code Online (Sandbox Code Playgroud)
}
我知道我在做些傻事.但我无法弄明白.我想在文档加载时立即替换标签内的一些文本.我知道函数正在执行.但它在getElementById语句中克隆了,我不知道为什么.输出应该说"New Junk".但总是说"Original Stuff".
<html>
<script>
window.onload = filltip();
function filltip() {
alert('xyz');
var id = 'qourl';
var txt = 'New Junk';
//alert('current html=' + document.getElementById(id).innerHTML);
document.getElementById(id).innerHTML = '?<span class="classic">' + txt +
'</span>';
}
</script>
<body>
<a href='#' id='qourl'>Original Stuff</a>
</body>
</html>
Run Code Online (Sandbox Code Playgroud) 我有一个非常简单的布局,看起来不正确.我已经搞乱了Firebug Lite和IE Developer Toolbar,但是在这种情况下,为什么右图像在左图像下方包裹起来似乎无法归结为什么.这是我为调试目的而简化的问题的链接. http://tunetra.de/test/layout.html
我也将在下面通过我的HTML.
<html>
<head>
<style>
#container
{
margin: 0px auto;
width: 1000px;
background: #fff;
}
#main
{
text-align: left;
}
</style>
</head>
<body style="text-align:center;">
<div id="container">
<div id="header">
<img src="img/left_image.png" style="width: 272px; height: 90px; float: left;position: relative;">
<div style="float: right;position: relative;background-color: #fff;width: 728px;height: 90px;">
<img src="img/right_image.png" style="">
</div>
</div>
<div id="main">
Lorem Ipsum Bla<br/> Bla<br/> Bla
</div>
</div>
</body>
</html>
Run Code Online (Sandbox Code Playgroud) javascript ×3
css ×2
css3 ×2
html ×2
apache ×1
apache2 ×1
asynchronous ×1
cakephp ×1
jquery ×1
node.js ×1
performance ×1
php ×1
subdomain ×1
virtualhost ×1